Forum Discussion
Yes/No Toggle that Delete's Item
- Feb 07, 2024
AP_TC_ECASD In that case, you can use the simple JSON like:
{ "_comment": "Toggle Buttons", "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "attributes": { "iconName": "Delete", "class": "ms-fontColor-red" }, "style": { "cursor": "pointer", "font-size": "35px", "display": "=if(@currentField,'none','block')" }, "customRowAction": { "action": "delete" } }Also, delete confirmation popup will be shown by default - this is default functionality (or limitation) of SharePoint JSON formatting which we cannot customize.
If you need a delete button against each row without confirmation, you cannot do it using JSON formatting. You will have to use the SPFx field customizer for such requirements - code/development experience is required.
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.
Hi ganeshsanap!
Ultimately, I'm not held to having the toggle at all. If there was just that delete button and it worked to delete the row, that would be the best scenario for the users who will be using it. I'm just looking for a way for the user to easily delete the row with a click of a button without having the confirmation and all that.
What are your thoughts?
AP_TC_ECASD In that case, you can use the simple JSON like:
{
"_comment": "Toggle Buttons",
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"iconName": "Delete",
"class": "ms-fontColor-red"
},
"style": {
"cursor": "pointer",
"font-size": "35px",
"display": "=if(@currentField,'none','block')"
},
"customRowAction": {
"action": "delete"
}
}
Also, delete confirmation popup will be shown by default - this is default functionality (or limitation) of SharePoint JSON formatting which we cannot customize.
If you need a delete button against each row without confirmation, you cannot do it using JSON formatting. You will have to use the SPFx field customizer for such requirements - code/development experience is required.
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.