Forum Discussion
JSON code to change color of Name of Folder in Sharepoint Online
Dears,
Kindly help me with the JSON code so that the color of rows in Name column is red.
I have achieved similarly in the Folder Child Count, however I am unable to do in Name column.
I want the Name column to be red of the value of Folder Child Count is 0.
cyberco20 What have you tried so far? You should be able to apply a very similar column formatting rule to your Name column, except you will want to reference the FolderChildCount column.
To reference that column, you would use the following syntax [$ColumnName]. So in this example, you would use [$FolderChildCount]
An example would be something like this:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if([$FolderChildCount] != '0','sp-field-severity--severeWarning', '')"
}
}
1 Reply
- Beau CameronCopper Contributor
cyberco20 What have you tried so far? You should be able to apply a very similar column formatting rule to your Name column, except you will want to reference the FolderChildCount column.
To reference that column, you would use the following syntax [$ColumnName]. So in this example, you would use [$FolderChildCount]
An example would be something like this:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if([$FolderChildCount] != '0','sp-field-severity--severeWarning', '')"
}
}