Forum Discussion
How can users change Yes/No columns?
- Apr 12, 2023
dgajohnson try using JSON sample given here: Yes/No Column Toggle
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
ganeshsanap thank you, this is working!
Do you know of a way to make it so that you can change the value with only one click? With this formatting the user has to click the cell, wait for it to load, and then change its value. Do you know of a method where the user could change the value with just one click?
dgajohnson try using JSON sample given here: Yes/No Column Toggle
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
- dgajohnsonApr 12, 2023Copper Contributor
ganeshsanap thanks! I found that one too. I ended up using this:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "button", "txtContent": "=if(@currentField, 'Yes', 'No')", "customRowAction": { "action": "setValue", "actionInput": { "MyCustomField": "=if(@currentField, false, true)" } }, "style": { "background-color": "=if(@currentField, '#0078d4', '#ffffff')", "color": "=if(@currentField, '#ffffff', '#333333')", "border": "none", "cursor": "pointer", "padding": "4px 12px", "border-radius": "4px" } }
ChatGPT made the style, and I pulled the customRowAction parameter from that repo.