Ag-grid: How to set custom background color on column header?
1 answer
Here is a plunker that showcases a header component like what you want. I took this from the examples in the docs for ag-grid . Take a look mainly at header.component.html
where the magic is.
I think the only confusing part is when you create the HeaderComponent:
export class HeaderComponent implements IHeaderAngularComp {
public color: string = '#'+(Math.random()*0xFFFFFF<<0).toString(16);
public params: MyParams;
private elementRef: ElementRef;
...
//You will need to get the params from agInit so that you can access
//the value for each column
agInit(params: MyParams): void {
this.params = params;
}
}
Please check their docs for a more detailed explanation, they are getting better every day
0
source to share