Antoine Bon
Antoine Bon

Reputation: 423

How to set style on a specific header in ag-grid

Im' trying to set style on a specific header in an ag-grid array generated dynamically. How Can I do this without manipulating the DOM ? This is a timeslot array and I want to highlight the current day.

I already tried to apply cellStyle, but it can't affect headers. Do you have some ideas ?

Some code generating the array :

this.tmpDefs = [{ headerName: '', field: 'user', width: 90, suppressSizeToFit: true }];

for(wantedDays){
   this.tmpDefs.push([Some generated children])
}

this.gridApi.setColumnDefs(this.tmpDefs);

Upvotes: 9

Views: 30475

Answers (1)

Grégory Elhaimer
Grégory Elhaimer

Reputation: 2801

You can use the headerClass property in your column definition.

Here is the full documentation about column properties: https://www.ag-grid.com/javascript-grid-column-properties/

Upvotes: 9

Related Questions