0

I have created cascading dropdown. I need to load dropdown based on parent dropdown selection. I am trying to use onpropertychange event. but I am getting error on super.onpropertychange saying {Property 'onPropertyChange' does not exist on type 'BaseClientSideWebPart'.}

please let us know what I havve missed.

 protected onPropertyChange(propertyPath: string, newValue: any):void{  
    if(propertyPath === "listDropDown"){  
      // Change only when drop down changes  
      super.onPropertyChange(propertyPath,newValue);  
      // Clears the existing data  
      this.properties.ItemsDropDown = undefined;  
      this.onPropertyChange('ItemsDropDown', this.properties.ItemsDropDown);  
      // Get/Load new items data  
      this.GetItems();  
    }  
    else {  
      // Render the property field  
      super.onPropertyChange(propertyPath, newValue);  
    }  
  }  
Mosè Raguzzini
  • 15,399
  • 1
  • 31
  • 43
swetha s
  • 33
  • 1
  • 1
  • 9

1 Answers1

2

Instead of onPropertyChange, perhaps you mean onPropertyFieldChanged from the BaseWebPart class?

The error message is accurate - web parts don't have a method called onPropertyChange. The above sounds like the closest match for what you are trying to do. Note that it takes not two arguments, but three: propertyPath, oldValue, and newValue.

Richard Li
  • 301
  • 1
  • 5