how to make css style !important inside ag-Grid's getRowStyle

23 Views Asked by At

getRowStyle(params) {
return { background-color: 'red !important'}
}
I know 'red !important' is not a valid. How to make background-color takes higher precedence over any other external styles?

2

There are 2 best solutions below

0
Naren Murali On

Property is invalid when it has hyphens in-between (background-color) change it to backgroundColor and it works great!

  getRowStyle: (params) => {
      return { backgroundColor: 'red !important'}
  },

Working Plunkr

0
Jason Batler On

The following code may be useful if you want to specify the background color for a specific cell.

{
  field: 'name',
  headerName: 'Name',
  cellStyle: (params) => {
    if (condition) {
      return { backgroundColor: 'red' };
    }
    return defaultStyle
  }
}