sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Sharepoint Framework Property Pane - building a dynamic property

Open SKempin opened this issue 8 years ago • 7 comments

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.

SKempin avatar Apr 23 '18 11:04 SKempin

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 avatar May 18 '18 15:05 aplantard

@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

SKempin avatar May 19 '18 13:05 SKempin

@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

SKempin avatar May 21 '18 09:05 SKempin

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.

russgove avatar Oct 05 '18 01:10 russgove

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.

sonicbaz avatar Oct 07 '18 07:10 sonicbaz

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.

andrewconnell avatar Jun 20 '19 10:06 andrewconnell

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

msft-github-bot avatar Jan 28 '20 00:01 msft-github-bot