Search code examples
javascriptcssangularag-gridag-grid-angular

How can i align column headers for some fields to be on the left and others on the right in Ag Grid?


How can I move the text right for some columns and left for others in the headers for an AG-grid control? I have tried using cellstyle and cellclass in the column definition but that did not work.

I was able to move the column data in left, right or center. but unable to move header data.

Thank you


Solution

  • The column headers are left-aligned by default.

    To right-align a column header, you can set the column definition's 'type' property to either 'rightAligned' or 'numericColumn', which is an alias for 'rightAligned'.

    The documentation is at https://www.ag-grid.com/javascript-grid-column-definitions/#right-aligned-and-numeric-columns