Skip to content

Commit

Permalink
fix(Table): virtual table with selection should tell all records, fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna authored and 潕量 committed Mar 25, 2022
1 parent bbf871c commit 62b4591
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/table/selection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export default function selection(BaseComponent) {
selectOneRow(index, record, checked, e) {
let selectedRowKeys = [...this.state.selectedRowKeys],
i;
const { primaryKey, rowSelection, dataSource } = this.props,
const { primaryKey, rowSelection, dataSource, entireDataSource } = this.props,
mode = rowSelection.mode ? rowSelection.mode : 'multiple',
id = record[primaryKey];
if (!id) {
Expand All @@ -266,10 +266,11 @@ export default function selection(BaseComponent) {
} else if (checked) {
selectedRowKeys = [id];
}
const records = unique(
dataSource.filter(item => selectedRowKeys.indexOf(item[primaryKey]) > -1),
primaryKey
);
let totalDS = dataSource;
if (Array.isArray(entireDataSource) && entireDataSource.length > dataSource.length) {
totalDS = entireDataSource;
}
const records = unique(totalDS.filter(item => selectedRowKeys.indexOf(item[primaryKey]) > -1), primaryKey);
if (typeof rowSelection.onSelect === 'function') {
rowSelection.onSelect(checked, record, records);
}
Expand Down

0 comments on commit 62b4591

Please sign in to comment.