Forum Discussion

jellybeancooper's avatar
jellybeancooper
Brass Contributor
Jan 16, 2024
Solved

How do you change the color of the second grouped item header in a list view

I have a list that is grouped by Building and then by Room.

I can use json to change the color of the headers as follows:

 

 

"groupProps": {
        "hideFooter":true,
      "headerFormatter": {
        "elmType": "div",
        "style": {
           "background-color": "blue"
        },

 

 

This makes Building header and Room header both blue. I would like to make the Room header a lighter colour of blue. Is this possible?

 

 

  • jellybeancooper

     

     You can use a condition on the field name for this.

     

      "groupProps": {
        "hideFooter": true,
        "headerFormatter": {
          "elmType": "div",
          "attributes": {
            "class": "sp-row-card"
          },
          "style": {
            "background-color": "=if(@group.columnDisplayName == 'Building','blue','lightblue')",
            "color": "white"
          }
        }
      }

     

     

1 Reply

  • ThomasAkalowski's avatar
    ThomasAkalowski
    Copper Contributor

    jellybeancooper

     

     You can use a condition on the field name for this.

     

      "groupProps": {
        "hideFooter": true,
        "headerFormatter": {
          "elmType": "div",
          "attributes": {
            "class": "sp-row-card"
          },
          "style": {
            "background-color": "=if(@group.columnDisplayName == 'Building','blue','lightblue')",
            "color": "white"
          }
        }
      }

     

     

Resources