Column formataing 'additionalRowClass' does not work

Tadas Cirklys 21 Reputation points
2021-11-02T19:39:19.303+00:00

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?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,762 questions
0 comments No comments
{count} votes

Accepted answer
  1. Emily Du-MSFT 42,101 Reputation points Microsoft Vendor
    2021-11-03T06:47:00.667+00:00

    @Tadas Cirklys

    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.


0 additional answers

Sort by: Most helpful