Sharepoint Framework Property Pane - building a dynamic property

Copper Contributor

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?

2 Replies

Here's a Custom SPFx webpart which lets you add unlimited number of filters. I'm not sure if it lets you delete them individually once added though.

 

https://github.com/spplante/react-content-query

 

 

Thanks, this is similar but is not the same functionality of the highlighted content web part. How can we get the source code for the highlighted content web part?