Sp-dev-docs: Where is IOnCustomPropertyFieldChanged on RC0?

Created on 20 Jan 2017  路  5Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [ X] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Enhancement / Suggestion
  • [ ] Additional article idea

According to this article:
https://dev.office.com/sharepoint/docs/spfx/web-parts/basics/integrate-with-property-pane

you should be able to import:
IPropertyPaneFieldType,
IOnCustomPropertyFieldChanged
from '@microsoft/sp-client-platform'

but these 2 classes are not available on sp-client-platform.
I麓ve found that IPropertyPaneFieldType have been renamed to PropertyPaneFieldType in the '@microsoft/sp-webpart-base', but I can麓t find the IOnCustomPropertyFieldChanged.

Thanks.

spfx-general answered fixed fixed-next-drop tracked uservoice-request

Most helpful comment

Hello @luismanez

Thanks for bringing this up and sorry for the delay. The change has benn made to resolve this issue. You will be getting it in the next release. The change we have made is, the onRender prop on the custom field will now have a changeCallback method passed in from the framework. This should be invoked if you want the framework to know that something has changed within the custom field. This will trigger the regular property pane field change flow.

This is how the onRender prop will look now on the IPropertyPaneCustomFieldProps

 /**
  * This API will be called once the custom field is mounted on the host element.
  *
  * @param domElement - DOM element on which the custom control needs to be mounted.
  * @param context (optional) - Instance specific context. This context was passed in the constructor.
  * @param changeCallback (optional) - Callback called when a field changes within the custom field.
  *  This will allow the property pane to be aware of the change and act accordingly.
  *  @param targetProperty (optional) - associated target property from the properties bag.
  *    if not provided then a custom value which is unique at the custom field level is assigned,
  *    which will be in the form of '__CustomField_<key provided when the custom field is created>'.
  *  @param newValue (optional) - new value of the property.
  *    newValue is ignored if targetProperty is not specified.
  */
 /* tslint:disable:no-any */
 onRender: (
   domElement: HTMLElement,
   context?: any,
   changeCallback?: (targetProperty?: string, newValue?: any) => void) => void;

Please let me know if you still need any more details in this regard.

I am closing the issue for now, but please feel free to re-open it if you still see the issue after the next drop.

Thanks,
Srikanth

All 5 comments

@manishgarg1 - can you chime in?

@luismanez , This documentation is inaccurate. Apologies for that. We are working on a solution to make custom fields to behave like other property types. Should be available soon.

Thanks @manishgarg1 Let me know if I can help.

Hello @luismanez

Thanks for bringing this up and sorry for the delay. The change has benn made to resolve this issue. You will be getting it in the next release. The change we have made is, the onRender prop on the custom field will now have a changeCallback method passed in from the framework. This should be invoked if you want the framework to know that something has changed within the custom field. This will trigger the regular property pane field change flow.

This is how the onRender prop will look now on the IPropertyPaneCustomFieldProps

 /**
  * This API will be called once the custom field is mounted on the host element.
  *
  * @param domElement - DOM element on which the custom control needs to be mounted.
  * @param context (optional) - Instance specific context. This context was passed in the constructor.
  * @param changeCallback (optional) - Callback called when a field changes within the custom field.
  *  This will allow the property pane to be aware of the change and act accordingly.
  *  @param targetProperty (optional) - associated target property from the properties bag.
  *    if not provided then a custom value which is unique at the custom field level is assigned,
  *    which will be in the form of '__CustomField_<key provided when the custom field is created>'.
  *  @param newValue (optional) - new value of the property.
  *    newValue is ignored if targetProperty is not specified.
  */
 /* tslint:disable:no-any */
 onRender: (
   domElement: HTMLElement,
   context?: any,
   changeCallback?: (targetProperty?: string, newValue?: any) => void) => void;

Please let me know if you still need any more details in this regard.

I am closing the issue for now, but please feel free to re-open it if you still see the issue after the next drop.

Thanks,
Srikanth

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings