Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to refresh PropertyFieldListPicker target site while pane is open #109

Closed
2 of 3 tasks
zshane15 opened this issue Oct 30, 2018 · 5 comments
Closed
2 of 3 tasks

Comments

@zshane15
Copy link

zshane15 commented Oct 30, 2018

Category

  • Enhancement
  • Bug
  • Question

Version

[1.11.0]

Expected / Desired Behavior / Question

Is there a way to refresh/update the webAbsoluteUrl property of a PropertyFieldListPicker field while the pane is open? I have a custom string property named siteUrl which is used to populate the webAbsoluteUrl property for a list picker. When the pane opens, and the siteUrl field is populated, the list picker works.

However, when I try changing the siteUrl field, it doesn't update the list picker. I have to close the pane and reopen it. So is there a way to reinitialize the pane while open after a field changes? Basically this would work similar to a cascading drop-down, the user needs to enter a Site Url before they can access the list picker.

I've tried the following:

protected onPropertyPaneFieldChanged(propertyPath: string, oldValue: any, newValue: any): void {
  if (propertyPath === 'siteUrl' && newValue) {
    ...
    this.context.propertyPane.refresh();
  }

This is how my list picker is setup:

PropertyFieldListPicker('listSelect', {
  ...
  onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
  properties: this.properties,
  context: this.context,
  webAbsoluteUrl: this.properties.siteUrl,
})

Observed Behavior

Property pane does not refresh the context for a PropertyFieldListPicker which uses a custom webAbsoluteUrl property which is based on a string field in the property pane.

@waldekmastykarz
Copy link
Member

I stumble upon exactly the same. It seems that loading lists from the specified site happens only on component mount rather than when properties have been changed.

@estruyf
Copy link
Member

estruyf commented Nov 5, 2018

@zshane15 this would be a good update to the control. Will add it as an enhancement.

@estruyf
Copy link
Member

estruyf commented Nov 5, 2018

I have implemented an enhancement to the single and multi-list picker controls. Feel free to test out the latest beta. More information about how you can do this can be found here: https://sharepoint.github.io/sp-dev-fx-property-controls/beta/

@zshane15
Copy link
Author

zshane15 commented Nov 5, 2018

Thanks @estruyf the beta works great! Exactly what I needed.

@harshdamaniahd
Copy link

Tested and works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants