refine store to set selectRow when receiving props

This commit is contained in:
Chun-MingChen 2018-03-17 17:05:02 +08:00
parent 0eda54b772
commit ceebdf5a13

View File

@ -22,19 +22,17 @@ export default Base =>
super(props);
this.handleRowSelect = this.handleRowSelect.bind(this);
this.handleAllRowsSelect = this.handleAllRowsSelect.bind(this);
props.store.selected = this.props.selectRow.selected || [];
props.store.selected = props.selectRow.selected || [];
this.state = {
selectedRowKeys: props.store.selected
};
}
componentWillReceiveProps(nextProps) {
if (nextProps.selectRow) {
this.store.selected = nextProps.selectRow.selected || [];
this.setState(() => ({
selectedRowKeys: this.store.selected
}));
}
this.setState(() => ({
selectedRowKeys: nextProps.store.selected
}));
}
/**