Feb 07 2020 05:46 AM
Hey all,
I have been trying for some time to get the list row color formatting to work. I have a SharePoint list that contain Employee information. There is a 'Status' column of type "Single line of text" with the values 'Active' and 'InActive'. I have been attempting to apply the following JSON to format rows based on 'InActive' employees vs. 'Active' ones, of course changing the column name to my own:
JSON from Microsoft Docs:
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Status] == 'Done', 'sp-field-severity--good', if([$Status] == 'In progress', 'sp-field-severity--low' ,if([$Status] == 'In review','sp-field-severity--warning', if([$Status] == 'Blocked','sp-field-severity--blocked', ''))))"
}
My version:
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Status] == 'Active', 'sp-field-severity--warning', if([$Status] == 'InActive', 'sp-field-severity--warning', ''))"
}
Maybe i'm missing some single or double quotes somewhere? When I click the 'Preview' button, all the Statuses in the column disappears... So I'm not entirely sure what's wrong.
Can someone please help? Thank you!
Apr 23 2020 05:08 AM - edited Apr 23 2020 05:10 AM
@Yarrah You need to specify also a cell formatting:
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Status] == 'Active', 'sp-field-severity--warning', if([$Status] == 'InActive', 'sp-field-severity--warning', ''))",
"elmType": "div",
"txtContent": "@currentField"
}