如何在AG网格控件的标题中居中放置文本? [英] How can I center the text in the headers for an AG-grid control?
问题描述
如何将文本放在AG网格控件的标题中?我曾尝试在列定义中使用cellstyle和cellclass,但这没有用。谢谢
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
推荐答案
我正在使用react,我只是将以下代码段添加到了Table组件的中。 css
I'm using react and I just added the following snippet to my Table component's .css
.ag-header-cell-label {
justify-content: center;
}
我要覆盖 .css $我通过devtools检查发现了
ag-grid
中的c $ c>类,发现它正在使用flexbox进行显示。
I'm overriding the .css
class class from ag-grid
which I found via devtools inspection, and discovered it's using flexbox for display.
请参阅示例(不做出反应,但概念相同): https://embed.plnkr.co/O3NI4WgHxkFiJCyacn0r/
See example (not react but same concept): https://embed.plnkr.co/O3NI4WgHxkFiJCyacn0r/
这篇关于如何在AG网格控件的标题中居中放置文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!