Formatting to set background colour of entire cell (not just text part)

Copper Contributor

I am using custom formatting along the following lines:

{
  "$schema": https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json,
  "elmType": "div",
  "txtContent": "@currentField",
  "attributes": {
    "class": "='ms-Link ' + if(endsWith([$FileLeafRef], '.msg'), 'sp-field-severity--good', '')"
  },
  "customRowAction": {
    "action": "defaultClick"
  }
}

This works fine, except that it only changes the background colour of the text part of the cell.  You can see in the following clip that, where the cell is larger (to fit content in other columns), the cell is larger than the textual content:

 

image001 (1).png

Is it possible to specify a background colour of the entire cell, based on file extension?

 

 

0 Replies