如何在ag-grid中自动换行标题 [英] how to wordwrap a header in ag-grid
问题描述
使用ag-grid,有没有办法将长标头分成2行...
Using ag-grid, is there a way to split a long header across 2 rows...
columnDefs标头名称的中断:'Long< br /> Header'
带我到那里(使用开发工具可以看到文本带有br),但是周围的元素之一的高度为25px; < div class = ag-header style = height:25px;>
,我认为该标题的第二行无法显示。
A break in the columnDefs headerName: 'Long<br />Header'
gets me part way there (using dev tools I can see the text has the br), however one of the surrounding elements has a height of 25px; <div class="ag-header" style="height: 25px;">
which I think causes the second line of the header to not be displayed.
我想知道是否要使用组头作为临时手段来拆分文本,但是长期使用(当需要分组时)将是不可行的...
I wondered about using group headers as an interim to get the text split, but longer term (when I need to group) that won't be an option...
推荐答案
尝试将以下内容添加到CSS:
Try to add the following to your CSS:
.ag-header-cell-label {
text-overflow: clip;
overflow: visible;
white-space: normal;
}
并将其添加到网格选项:
and add this to your grid options:
headerHeight: 48
这篇关于如何在ag-grid中自动换行标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!