Forum Discussion
Column formatting now rolling out to first release users
This feature is fully rolled out and to our knowledge, there's no way to block the functionality. Can you message me the JSON that you're trying that's not working? Are ALL samples that you've tried not working?
below is the json im using, it does work (but not when I switch to classic sharepoint (lol), can you tell me how to alter this code snippet so that the cells background is red with white text in bold
{
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": {
"operator": "?",
"operands": [
{
"operator": "<=",
"operands": [
"[$Alert_x0020_date]",
"@now"
]
},
"#ff0000",
""
]
}
}
}
- LincolnDeMarisNov 27, 2017
Microsoft
Column formatting only works in modern.
Try this JSON.
{
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$Alert_x0020_date]",
"@now"
]
},
"#ff0000",
""
]
},
"color": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"[$Alert_x0020_date]",
"@now"
]
},
"#ffffff",
""
]
}
}
}- Stephen WALKERDec 12, 2017Copper Contributor
I still have this problem, that I could do with some help with, the column in sharepoint is set as a calculated column, with the date and time format set as date only and the json code added as you sent me, but it displays like this 2016-01-03TO8:00:00Z, how can I get it to display correctly, ie 03-01-2016, it does however work correctly if I switch to classic view, is there some more json code I can put in to display it in dd/mm/yy format
- DeletedDec 12, 2017
Stephen mine did that as well, but the way I got around it was to use the =TEXT([Date],"dd/MM/yyyy") function in the Calculated field.
I see calculated fields are not yet supported. As json code on it only partially works for some reason.
- Stephen WALKERNov 28, 2017Copper Contributor
It works :-) , thanks, I am trying to learn json code and am currently looking through some training videos on youtube.
I have one other problem, that I could do with some help with, the column in sharepoint is set as a calculated column, with the date and time format set as date only, but it displays like this 2016-01-03TO8:00:00Z, how can I get it to display correctly, ie 03-01-2016, it does however work correctly if I switch to classic view