Right align column headers in AgGrid

ⅰ亾dé卋堺 提交于 2021-01-05 09:45:26

问题


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"


回答1:


You would need to make these 2 changes to the css file to make it happen... since there is a little burger menu which gets visible on hover also.

::ng-deep .ag-cell-label-container{flex-direction: row}
::ng-deep .ag-header-cell-label { flex-direction: row-reverse; }

Forked your stackblitz with this change here




回答2:


working stackblitz fixed by defining template in headerComponentParams.



来源:https://stackoverflow.com/questions/57933672/right-align-column-headers-in-aggrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!