diff --git a/src/lib/multiSelect.js b/src/lib/multiSelect.js index 07f951e..6ccdb19 100644 --- a/src/lib/multiSelect.js +++ b/src/lib/multiSelect.js @@ -21,7 +21,7 @@ export default function multiSelect(Table) { this.splice(index, 1); } }; - return class BookLoader extends Component { + return class multiSelect extends Component { constructor(props) { super(props); let { selectDisabled, data } = props, @@ -39,6 +39,25 @@ export default function multiSelect(Table) { data: this.props.data }; } + componentWillReceiveProps(nextProps) { + let props = this.props, + { selectDisabled, data } = props, + checkedObj = {}; + if (nextProps.data !== data) { + for (var i = 0; i < nextProps.data.length; i++) { + let bool = selectDisabled(nextProps.data[i], i); + if (!bool) { + checkedObj[nextProps.data[i]["key"]] = false; + } + } + this.setState({ + checkedAll: false, + checkedObj: checkedObj, + selIds: [], + data: nextProps.data + }); + } + } onAllCheckChange = () => { let self = this; let listData = self.state.data.concat();