microsoft / Viva-Connections-Extensibility-Beta

38 stars 6 forks source link

[Web Part Name]: "this.properties.count" is not working under *****PropertyPane.ts file #24

Closed vasanthkumarc94 closed 3 years ago

vasanthkumarc94 commented 3 years ago

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.

Versions

[ Windows ] Operating System [ 12.13 ] Node version [ 2.3.0 ] Gulp version [ ] SPFx Generator version (npm list -g @microsoft/generator-sharepoint)

Expected or Desired Behavior

I am trying to get the webpart properties in the ***PropertyPane.ts file to do the Webpart property validation. Ex: disabled:this.properties.count?false:true

but I am not getting the webpart property in the propertypane.ts file. In normal SPFx webpart I will be able to get these webpart properties easily to do the validation.

ms-nichoi commented 3 years ago

Since the property pane is defined in a separate class than the ACE (which has access to its property bag), you could try passing in properties to getPropertyPaneConfiguration

vasanthkumarc94 commented 3 years ago

yes I have tried that by passing the properties to the class by extending the BaseWebpart, unfortunately still I can see the properties not available.

johnguy0 commented 3 years ago

@vasanthkumarc94 Since Adaptive Card Extensions are not web parts, you cannot extend from BaseWebPart. @ms-nichoi's suggestion is to modify the getPropertyPaneConfiguration signature in your code.

Something like this:

// MyPropertyPane.ts
public getPropertyPaneConfiguration(properties: IMyAdaptiveCardExtensionProperties): IPropertyPaneConfiguration {
  ....
}
// MyAdaptiveCardExtension.ts
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
  return this._deferredPropertyPane!.getPropertyPaneConfiguration(this.properties);
}
vasanthkumarc94 commented 3 years ago

yes it worked for me... thank you @johnguy0

vasanthkumarc94 commented 3 years ago

it worked... thank you for immediate response