3

I'm trying to create a custom property pane field to allow the user to configure a list and then a list view to be used by the web part.

I followed the instructions of this Custom field example section.

First, the interface of the example code seems to be different from my environment. In my environment, onRender only takes the HTMLElement to render the custom control in. There's no context nor onChanged parameters.

Secondly, if I ignore those differences, I can get my control to render on the page but I can't figure out how to tell SharePoint to save the selected value to a property. I was looking at how the TextField works and there's a get value property that I tried implementing in my control but didn't have any luck.

Does anyone have a working example of a custom property pane field?

  • Adding the code you have so far will help users to answer your question. – Erin L Aug 25 '16 at 15:07
  • It seems the tutorial is out of date. You might want to open an issue here: github.com/SharePoint/sp-dev-docs/issues – Vardhaman Deshpande Aug 25 '16 at 15:46
  • Here's the current version of the control: pastebin.com/J7am7RqE Note that currently I don't have the dropdown for the views, I'm trying to make it work first with just a selection of a list to reduce complexity. To use the component, first you of course have to import it to your web part. The following code show's how I'm rendering it to the property pane: pastebin.com/r89uWHKi Thanks! – Rafael Rocha Aug 25 '16 at 16:34
5

I've updated the documentation (https://github.com/SharePoint/sp-dev-docs/wiki/Integrating-Property-Pane) so that it now works.

For now, it's the responsibility of the developer to know what properties are being affected by the control (it could be one or many), and write them back to the host webpart.

I'll add one more thing. If you are doing this to populate a dropdown with SharePoint data, take a look at this post - SharePoint Framework web parts - dynamic properties pane

  • Thank you @PatMill_MSFT. Writing the property back to the host worked for me. – Rafael Rocha Aug 25 '16 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.