Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Table]:树形table,当rowKey 参数传入一个函数时, 选择行-结果不正确。 #2051

Closed
gavin-hao opened this issue Jun 1, 2022 · 0 comments
Labels
🐛 bug Something isn't working

Comments

@gavin-hao
Copy link
Contributor

 <Table<DataSourceType>
    rowSelection={{
      selectedRowKeys: selectedKeys,
      onChange: (keys) => setSelectedKeys(keys),
      getCheckboxProps: (record) => ({ disabled: record.id === '2-2' || record.age < 5 })
    }}
    rowKey={(r) => `#${r.id}`}
    expandable={{ defaultExpandAllRows: true }}
    pagination={{ pageSize: 10, showQuickJumper: false, showSizeChanger: false }}
    columns={columns}
    dataSource={dataSource}
  />
const dataSource: DataSourceType[] = [
    {
      id: 'id-1',
      name: 'Jerry',
      age: 30,
      address: 'address',
      children: [
        {
          id: '1-1',
          age: 13,
          address: 'child address',
          name: 'child name',

        },
        {
          id: '1-2',
          age: 13,
          address: 'child address',
          name: 'child name',

        },
      ],
    },
    {
      id: 'id-2',
      name: 'Tom',
      age: 28,
      address: 'address',
      children: [
        {
          id: '2-1',
          age: 13,
          address: 'child address',
          name: 'child name',
        },
        {
          id: '2-2',
          age: 13,
          address: 'child address',
          name: 'child name',
        },
      ],
    },
    {
      id: 'id-3',
      name: 'Tom',
      age: 28,
      address: 'address',
      children: [
        {
          id: '3-1',
          age: 13,
          address: 'child address',
          name: 'child name',
          children: [
            {
              id: '3-1-1',
              age: 13,
              address: 'child address',
              name: 'child name',
            }
          ]
        },
      ],
    },
    ...genDataSource(50),
  ];

如上面的代码,此时将无法选中 子节点行。
-- 且 选择行 功能代码 大量不必要的 执行代码。需要优化实现。

@gavin-hao gavin-hao added the 🐛 bug Something isn't working label Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants