如何在 AG-Grid 中的行之间添加间距或边距?

问题描述 投票:0回答:0

我正在尝试创建一个具有 Master/Detail 功能的 AG-Grid 表。在处理样式时,我遇到了上述问题。我也在使用 autoHeight 属性设置为 true.

下面是我用来设置行样式的代码。

getRowStyle: (params: any) => {
    const rowIndex = params.node.rowIndex;

    return {
        backgroundColor: rowIndex % 2 === 0 ? "#c9daf8" : "#6d9eeb",
        marginTop: rowIndex === 0 ? "0" : `${10 * rowIndex}px`,
        borderRadius: "8px",
        border: "none",
    };
},

这导致某些行被剪裁,如屏幕截图所示。有谁知道如何解决这个问题?

javascript reactjs ag-grid ag-grid-angular ag-grid-react
© www.soinside.com 2019 - 2024. All rights reserved.