Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Right align column headers in AgGrid

I am trying to right-align the column headers in the AgGrid. I know how to do this implementing a custom header component using IHeaderAngularComp and supplying my own template however that seems like a lot of work for something that should be trivial.

https://stackblitz.com/edit/angular-ag-grid-angular-ebvgjb

Align price column heading to right to match alignment with cell contents

I am using the following libraries.

"ag-grid-angular": "21.2.1"

"ag-grid-community": "21.2.1"

like image 333
Imran Avatar asked Mar 04 '23 10:03

Imran


1 Answers

If you want all column headers to align right:

defaultColDef: { headerClass: "ag-right-aligned-header"}

If you want a single column header to align right:

{ headerName: "name", field: "field", headerClass: "ag-right-aligned-header" }
like image 115
ADT Avatar answered Mar 13 '23 01:03

ADT