Sharepoint Framework Property Pane - building a dynamic property
I'm attempting to build a dynamic property in the Property Pane of a React based Sharepoint Online Web Part.
In order to achieve this I wish to iterate through an array of data in the PP, to create multiple drop down fields. Currently I can only create drop down fields through individual variables, not arrays or objects (as these can not be iterated through in the PP render method). This means that I can only render a predefined number of drop down fields in the PP.
Microsoft have already achieved this functionality on their 'Highlighted Content' Web Part, but haven't published the source code for this, so I cannot see how they have achieved it. On this Web Part the user can add multiple PP drop down fields and remove these individually too, without limit (i.e. they are rendered fully dynamically).
Is this possible to do or am I taking the wrong approach?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 50b669b5-e0bf-5e0c-0811-10c6254742a6
- Version Independent ID: ee0aa417-37e0-3cb3-179b-dbb47f8534a5
- Content: Make your SharePoint client-side web part configurable
- Content Source: docs/spfx/web-parts/basics/integrate-with-property-pane.md
- Service: unspecified
- GitHub Login: @spdevdocs
- Microsoft Alias: spdevdocs
Hello, Just checking if you have found any solution to this ? i'm also trying to reproduce the "Highlighted content" web part property pane but I can't find any clue to help me on this subject
Thanks in advance
@aplantard I haven't found a solution no, it's quite frustrating. My only suggestion is to contact via the SP monthly call - https://github.com/SharePoint/PnP/wiki/Community-call
@aplantard https://techcommunity.microsoft.com/t5/SharePoint-Developer/bd-p/SharePointDev may also be of help.
https://techcommunity.microsoft.com/t5/SharePoint-Developer/Sharepoint-Framework-Property-Pane-building-a-dynamic-property/td-p/195691
Hey, not sure if this still an issue for you, but,,, I did something like this in the spfx samples webpart at https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-multilist-grid
User selects lists and them custom panels are shown to let the user configure settings for each column in the list,. Be forewarned... it worked in older versions of spfx (i think 1.2) but not sure about later versions.
I use knockout so not React but implemented my own IPropertyPaneField where I have my custom render method and register a component for the property pane that has it's own viewmodel. You can do dynamic control rendering, although I would carefully look at what data I was expecting and how I would bind to ui to avoid reinventing the wheel.
You might want to check this out as well: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/use-cascading-dropdowns-in-web-part-properties
A few solutions have been posted here... seems like we can close this issue. Feel free to submit a comment/issue if you have additional questions.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues