小编Osh*_*ini的帖子

如何在react-table中使用rowspan

知道如何在反应表中使用 rowSpan 。对于下面的示例 usernameFormatter 有多个值。注意:附件图片是复制的,但这看起来像我想要的

const columns = [
     {
         accessor: "id",
         show: false,
     },
     {
        Header: "Username",
        id: "username",
        accessor: "username",
        Cell: this.usernameFormatter,
        enableRowSpan: true
     }
]
          
<ReactTable
    data={this.state.users}
    filterable={true}
    columns={columns}
    defaultPageSize={18}
    getTdProps={(state, rowInfo, column) => {
        const index = rowInfo ? rowInfo.index : -1;
        return {
            onClick: (e, handleOriginal) => {
                if (column.Header === undefined) {
                    handleOriginal();
                } else {
                    if (rowInfo !== undefined) {
                        this.selectedRow = index;
                        this.onRowSelect(rowInfo.original.id);
                    }
                }
            },
        };
    }}
/>
                
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

reactjs react-table

7
推荐指数
1
解决办法
2937
查看次数

标签 统计

react-table ×1

reactjs ×1