Forum Discussion
Sharepoint Modern Calendar Filter JSON
Hello,
I am curious if anyone can help me with what JSON code I need in order to not display an item if a Yes/No column is "Yes AKA True".
I know how to change the font colors, etc, but not sure how I can't just have it display nothing. Or would my only work around be making everything white, so you can't see it even though the item is still on the calendar?
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$RequestCancelled_x003f_]",
true
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgBrown' , 'sp-css-backgroundColor-BgGold sp-css-color-GoldFont')+' sp-field-fontSizeSmall'",
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgGreen' ,
Hello as733y
you can filter your view and exclude the items, that you don't want to show.
Is that a way to go?
Regards, Dave
2 Replies
as733y If you want to hide list items based on Yes/No field, best way is to use the filtering in list view settings as suggested by DaveMehr365 .
If you don't want to use the view filtering, you can achieve this using JSON as well. You have to add "display" property inside "style" of outer most element in view formatting JSON.
For Example:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "hideSelection": true, "hideColumnHeader": true, "rowFormatter": { "elmType": "div", "style": { "display": "=if([$RequestCancelled_x003f_], 'block', 'none')" }, "txtContent": "[$Title]" } }
Documentation: Use view formatting in SharePoint
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.
Hello as733y
you can filter your view and exclude the items, that you don't want to show.
Is that a way to go?
Regards, Dave