Search code examples
ag-grid-angular

can we change the headerClass based on the rowdata in ag-grid?


I need to set a header class for the header bg depending on the filtered rowdata that is displayed in the grid. Basically I need to get the filtered rows, check for a boolean on the specific column cell and then set the bg headerClass based on that counting.

I am wondering if that is possible, I looked around and I know that the headerClass prop can be a function but if I use the rowdata that won't work when the grid is filtered.

Any ideas?


Solution

  • I solved it by using this example.

    Basically you can set the headerClass as a function and from there you can dynamically change the header class based on the cellstate.