TransWikia.com

Hide table column from property pane (WebPart)

SharePoint Asked by JohnRambo on October 25, 2021

I am still new into the WebPart development so bare with me:

I have created a WebPart consisting of table and I have several toggles in the settings that can show hide a column in the table. Somehow I cannot get the part how I can make the hook between the settings and the table itself.

So basically my question is: How I can detect the "change" event of the toggle in the property pane and do something(eg. call custom function) when it happens? Like is there a standard to do it?

I have created the WebPart with the use of yo @microsoft/sharepoint and I am using React as JavaScript framework.

Any help and ideas are appreciated.

Best regards,

Dimitar Georgiev

One Answer

There is actually a method present for detecting property pane change,

onPropertyPaneFieldChanged,

enter image description here

then there is also the , refresh method inside the sp context.

enter image description here

You should also make sure your webpart properties were tied up with a state in your components, cause changing the state will re render the webpart, so basically updating a webpart property that has a component state listening to it will re render the data.

Here is an additional resource.

Hope it helps! Happy Coding!

Answered by Edwin on October 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP