mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
refine store to set selectRow when receiving props
This commit is contained in:
parent
0eda54b772
commit
ceebdf5a13
@ -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
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user