I do not know JSON, so I am struggling to figure this out. I have a drop down menu column and if the user selects one of the drop down menus (Lets say its called "Peer Review - Rushed") I would like the cell to show red, or even the whole row if need be. How do I do that?
-
Do you need this in only the Modern UI, or both in Classic UI and Modern UI? JSON only works with the Modern UI.– Mike Smith - MCTCommented Oct 26, 2018 at 20:10
-
Mike, I think just modern.– Klj126Commented Oct 26, 2018 at 21:13
-
@MikeSmith-MCT-MVP Just kidding, apparently people are using the classic, am I SOL because of this?– Klj126Commented Oct 26, 2018 at 22:03
-
No, just need a different solution. Classic uses JSLink. If no one else does... I'll try to post an example this weekend.– Mike Smith - MCTCommented Oct 27, 2018 at 2:08
Add a comment
|
1 Answer
For the Modern UI and JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "span",
"debugMode": true,
"txtContent": "@currentField",
"style": {
"color": "=if(@currentField == 'Peer Review - Rushed', 'Red', if(@currentField == 'Peer Review - Slow', 'Blue', 'Black'))"
}
}
This will set Red, Blue, or if other Black.
- Click the column heading's dropdown
- Click Column Settings.
- Click Format this column.
- Copy and paste the JSON and click Save.