Jun 07 2017 10:29 AM
When creating a check box in the property pane for my web part, I am setting the 'checked' property to 'true':
But when I run the web part in the SPO workbench and examine the property pane, the control is there but not checked:
Has anyone else run into this issue? Is there something I have or haven't done that might be causing this to behave this way? Any advice would be helpful, I really need to get this web part to start it's life on the page with the property pane check box in a checked state. Thanks.
Jun 08 2017 03:46 PM
While no one seems to know why this isn't working, I found a workaround for my particular situation. Since I am using the onPropertyPaneConfigurationStart() method to fill the items into the pulldown menu of list names, I put an extra line of code in that method that sets the property to "true" before I call this.context.propertyPane.refresh().
//--- enable the menu this.listsDropdownDisabled = false; this.properties.filterHidden = true; //--- re-render the property pane to show the menu with items this.context.propertyPane.refresh();
Apr 29 2020 11:49 PM
@Joseph Ackerman Nearly 3 years on and I don't think this issue has been resolved as it (or something very like it) occurred for me today. I was expecting the checkbox to be checked based on the default property value set in the manifest.json file but it seems that this default value is not picked up on first load. This is not a problem if you want the control to be unchecked by default but it is an issue if you want it the other way round.
The way I solved it was to set the default value as true in the onInit override.
protected onInit(): Promise<void> {
return super.onInit().then(_ => {
this.properties.my_bool_property = true;
});
}