selectedRows should match selectedRowKeys, close #2566

This commit is contained in:
afc163 2016-08-03 21:27:45 +08:00
parent 2536dbee78
commit 9726122904

View File

@ -105,7 +105,7 @@ export default class Table extends React.Component {
if (!rowSelection.getCheckboxProps) {
return [];
}
return this.getFlatCurrentPageData()
return this.getFlatData()
.filter(item => this.getCheckboxPropsByItem(item).defaultChecked)
.map((record, rowIndex) => this.getRecordKey(record, rowIndex));
}
@ -177,7 +177,7 @@ export default class Table extends React.Component {
if (rowSelection && !('selectedRowKeys' in rowSelection)) {
this.setState({ selectedRowKeys });
}
const data = this.getFlatCurrentPageData();
const data = this.getFlatData();
if (!rowSelection.onChange && !rowSelection[selectWay]) {
return;
}
@ -709,6 +709,10 @@ export default class Table extends React.Component {
return data;
}
getFlatData() {
return flatArray(this.getLocalData());
}
getFlatCurrentPageData() {
return flatArray(this.getCurrentPageData());
}