Feb 19 2020 12:47 PM
SharePoint 2019 Column Formatting On Premise doesn't work when you add it on
a Page with List Web Part
How to test
Try this on SharePoint online and On premise
Do column formatting with this json
Then add a page with communication template
Add list select the view
check the conditional formatting is gone on On Prem
check the conditional formatting is working on On Office 365
Json used is
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"debugMode": true,
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$ColorCoded]",
"Red"
]
},
"red",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$ColorCoded]",
"Blue"
]
},
"aqua",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$ColorCoded]",
"Green"
]
},
"Green",
"silver"
]
}
]
}
]
},
"color": "black",
"padding-left": "10px"
}
}
Feb 19 2020 03:02 PM
Oct 06 2020 04:22 PM
There is some difference in JSON format in On-prem and Sharepoint online@jinthakur
Excel-style Syntax does not work in the On-prem version.
Inbox me I can rectify this JSON.
Oct 10 2023 01:11 PM
@jinthakur
I'm on premise and need to do colour coding. I'm using your code above as a basis but can't tell which "red" for instance is a style declaration and which is the text in the current field.
I have a choice column called category will values such as "Business", "Project"
Are you able to tell me how to amend your code sample to check for these text values please?