SPFx webpart onPropertyChanged didn't fire after control's content was changed
-
11-12-2020 - |
Pergunta
I am recently trying the SPFx webpart for Drop 5. I understood that the drop 5 started to use @microsoft/sp-webpart-base instead of @microsoft/sp-client-preview. What I did was to add two dropdown controls and dropdownB's list was depended on dropdownA. As I understand correctly, the protected onPropertyChanged(propertyPath: string, oldValue: any, newValue: any): void method should be triggered whenever dropdownA is changed at reactive mode. However, this method didn't triggered when I connected to SPO. This method can be fired at local mode. Anyone has ideas about this? I kindly remembered it was fine on both local and SPO under Drop 4.
protected onPropertyChanged(propertyPath: string, oldValue: any, newValue: any): void {
console.log("onPropertyChanged: " + propertyPath);
super.onPropertyChanged(propertyPath, oldValue, newValue);
}
Solução
Two things.
upgrade to drop 6 (https://github.com/SharePoint/sp-dev-docs/wiki/Release-Notes-Drop-6)
method signature has changed to
"onPropertyPaneFieldChanged(...)"
with the same parameters and return type as before.