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