提交 01468cdc 编写于 作者: A afc163

improve getDefaultSelection code implementation

上级 092e2e1a
......@@ -67,19 +67,12 @@ let AntTable = React.createClass({
},
getDefaultSelection() {
let selectedRowKeys = [];
if (this.props.rowSelection && this.props.rowSelection.getCheckboxProps) {
let data = this.getCurrentPageData();
data.filter((item) => {
if (this.props.rowSelection.getCheckboxProps) {
return this.props.rowSelection.getCheckboxProps(item).defaultChecked;
}
return true;
}).map((record, rowIndex) => {
selectedRowKeys.push(this.getRecordKey(record, rowIndex));
});
if (!this.props.rowSelection || !this.props.rowSelection.getCheckboxProps) {
return [];
}
return selectedRowKeys;
return this.getCurrentPageData()
.filter(item => this.props.rowSelection.getCheckboxProps(item).defaultChecked)
.map((record, rowIndex) => this.getRecordKey(record, rowIndex));
},
componentWillReceiveProps(nextProps) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册