question

TadasCirklys-6145 avatar image
0 Votes"
TadasCirklys-6145 asked TadasCirklys-6145 commented

Column formataing 'additionalRowClass' does not work

I want to have the entire line in different color if the date field is earlier than now. I have found some JSON scripts, however the ones I found makes my column information disappear. The info is still there on edit but it is not visible and the colors does not change as well.

I have used the following code:

 {
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "additionalRowClass": "=if([[$Traukinio_x0020_data] <= @now, 'sp-field-severity--severeWarning', '')"
 }


also tried this:

 {
 "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
 "additionalRowClass": "=if([[$Traukinio_x0020_data] <= @now, 'sp-field-severity--severeWarning', '')",
 "elmType": "div",
 "txtContent": "@currentField"
 }

Can you please help me modify this?


office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

EmilyDu-MSFT avatar image
0 Votes"
EmilyDu-MSFT answered TadasCirklys-6145 commented

@TadasCirklys-6145

Here're steps:

1.All Items -> Format current view -> Advanced mode.
146081-1.png

2.Use below codes in the Advanced mode.

 {
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "additionalRowClass": "=if([$Traukiniodata] <= @now, 'sp-field-severity--severeWarning', '')"
 }

146091-2.png
3.Result.
146043-3.png


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




1.png (10.4 KiB)
2.png (27.7 KiB)
3.png (6.7 KiB)
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hey @EmilyDu-MSFT,

Thanks for your answer, I have followed your steps and it looks like it should work, but for some reason I get all rows highlighted no matter the date, any idea what could be wrong here?

146111-image.png


146029-image.png


0 Votes 0 ·
image.png (58.8 KiB)
image.png (32.4 KiB)

@TadasCirklys-6145

You make a mistake in codes. Please remove an extra $ symbol.

146030-1.png


0 Votes 0 ·
1.png (60.5 KiB)

I removed that, however this does not change the outcome. All rows remain highlighted.

0 Votes 0 ·
Show more comments

All good, found the issue, column name should have been $Traukinio_x0020_data

0 Votes 0 ·