[Table] 行选择在列表无数据情况下,默认为全选
YannLynn opened this issue · comments
YannLynn commented
Is there an existing issue for this?
- I have searched the existing issues
Which Component
Table
Semi Version
latest
Current Behavior
行选择在列表无数据情况下,默认为全选
Expected Behavior
行选择在列表无数据情况下,默认不为全选
Steps To Reproduce
ReproducibleCode
import React from 'react';
import { Table, Avatar } from '@douyinfe/semi-ui';
import { IconMore } from '@douyinfe/semi-icons';
function App() {
const columns = [
{
title: '标题',
dataIndex: 'name',
width: 400,
render: (text, record, index) => {
return (
<div>
<Avatar
size="small"
shape="square"
src={record.nameIconSrc}
style={{ marginRight: 12 }}
></Avatar>
{text}
</div>
);
},
},
{
title: '大小',
dataIndex: 'size',
},
{
title: '所有者',
dataIndex: 'owner',
render: (text, record, index) => {
return (
<div>
<Avatar size="small" color={record.avatarBg} style={{ marginRight: 4 }}>
{typeof text === 'string' && text.slice(0, 1)}
</Avatar>
{text}
</div>
);
},
},
{
title: '更新日期',
dataIndex: 'updateTime',
},
{
title: '',
dataIndex: 'operate',
render: () => {
return <IconMore />;
},
},
];
const rowSelection = {
getCheckboxProps: record => ({
disabled: record.name === '设计文档', // Column configuration not to be checked
name: record.name,
}),
onSelect: (record, selected) => {
console.log(`select row: ${selected}`, record);
},
onSelectAll: (selected, selectedRows) => {
console.log(`select all rows: ${selected}`, selectedRows);
},
onChange: (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
},
};
const pagination = useMemo(
() => ({
pageSize: 3,
}),
[]
);
return <Table columns={columns} dataSource={[]} rowSelection={rowSelection} pagination={pagination} />;
}
render(App);
Environment
- OS:
- browser:
Anything else?
No response