How can I center the text in the headers for an AG-grid control?

前端 未结 9 1215
长情又很酷
长情又很酷 2021-02-19 00:22

How can I center the text in the headers for an AG-grid control? I have tried using cellstyle and cellclass in the column definition but that did not work. Thank you

9条回答
  •  情深已故
    2021-02-19 01:03

    I'm using react and I just added the following snippet to my Table component's .css

    .ag-header-cell-label {
       justify-content: center;
    }
    

    I'm overriding the .css class class from ag-grid which I found via devtools inspection, and discovered it's using flexbox for display.

    See example (not react but same concept): https://embed.plnkr.co/O3NI4WgHxkFiJCyacn0r/

提交回复
热议问题