提交 092e2e1a 编写于 作者: A afc163

empty selectedRowKeys when dataSource changed, ref #793

上级 d39e5ca4
...@@ -91,18 +91,9 @@ let AntTable = React.createClass({ ...@@ -91,18 +91,9 @@ let AntTable = React.createClass({
// 外界只有 dataSource 的变化会触发新请求 // 外界只有 dataSource 的变化会触发新请求
if ('dataSource' in nextProps && if ('dataSource' in nextProps &&
nextProps.dataSource !== this.props.dataSource) { nextProps.dataSource !== this.props.dataSource) {
let selectedRowKeys = this.state.selectedRowKeys;
// 把不在当前页的选中项去掉
let currentPageRowKeys =
this.getCurrentPageData(nextProps.dataSource).map(
(record, i) => this.getRecordKey(record, i)
);
selectedRowKeys = selectedRowKeys.filter((key) => {
return currentPageRowKeys.indexOf(key) >= 0;
});
this.setState({ this.setState({
selectionDirty: false, selectionDirty: false,
selectedRowKeys, selectedRowKeys: [],
}); });
} }
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册