3

Where the data of SharePoint framework property pane is saved.? Can't we access it directly? Also if we have deleted a instance of our app from the page, the property pane data gets deleted permanently?

5

In the properties pane config, you'll have something similar to this:

PropertyPaneSlider('TestSliderRed', {
    label: 'testSliderRedLabel',
    min: 0,
    max: 255,
    showValue: true,
}),

It's the value in the first part of the property ('TestSliderRed', in this case) that you're looking for. In order to access the value that the slider is currently set to, you'll need this:

var redVal = this.properties.TestSliderRed;

The variable can then be used where needed within your code.

Please note that the answer above assumes that you're trying to use the property value within the SPFx code and that you're trying to get the current property pane value that a user has set. Let us know if it's something else that you're looking for.

Regarding your second question, I believe that if an SPFx app is removed then you'll lose the property pane data, yes. One solution that I can think of is that you should be able to update a SharePoint list with the values if they're important to you. I've not tested, but can't see any reason why it wouldn't work.

  • Yes there is some important data in one of the field of property pane, how can i update it in SharePoint list.? I mean, do i need to write custom code to update the list through my code, each time my property pane data is saved.? Or is there a better and simplified approach for the same. – Dilip Kumar Yadav Jul 9 '17 at 7:14
  • You are aware that the user must have edit rights over the page to be able to update the property pane, and that it's a global thing rather than unique to each user, right? The reason I ask is because I can't quite imagine what you would need to store is all. If you do still need to do this, a few examples on CRUD through SPFx put out by MS can be found here: github. – Cellv2 Jul 9 '17 at 8: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.