是否可以在 ag-grid 中的行组周围放置边框
Is it possible to put borders around row groups in ag-grid
有没有人在行组周围放置边框以帮助使他们的网格更易于阅读?如果是这样,将不胜感激。
可以用getRowStyle
to specify which rows you need to style. In your case, you can find if a row is a normal row or a row group by checking if RowNode.group
是true
.
AgGrid 仅使用 border-top
设置行边框样式。一行的 border-bottom
实际上是其下一行的 border-top
,这意味着您可以通过设置第一个子项的 border-top
的样式来直观地设置行组的 border-bottom
的样式小组 (RowNode.firstChild
).
这是一个例子:
const getRowStyle = (params) => {
const { node } = params;
if (
(node.rowIndex !== 0 && node.group) ||
(!node.group && node.firstChild)
) {
return { borderTop: "pink solid 1px !important" };
}
}
现场演示
有没有人在行组周围放置边框以帮助使他们的网格更易于阅读?如果是这样,将不胜感激。
可以用getRowStyle
to specify which rows you need to style. In your case, you can find if a row is a normal row or a row group by checking if RowNode.group
是true
.
AgGrid 仅使用 border-top
设置行边框样式。一行的 border-bottom
实际上是其下一行的 border-top
,这意味着您可以通过设置第一个子项的 border-top
的样式来直观地设置行组的 border-bottom
的样式小组 (RowNode.firstChild
).
这是一个例子:
const getRowStyle = (params) => {
const { node } = params;
if (
(node.rowIndex !== 0 && node.group) ||
(!node.group && node.firstChild)
) {
return { borderTop: "pink solid 1px !important" };
}
}