fix(multiSelect.js): 修复全选功能在更新数据时bug
This commit is contained in:
parent
b63541c144
commit
b9de7de510
|
@ -21,7 +21,7 @@ export default function multiSelect(Table) {
|
||||||
this.splice(index, 1);
|
this.splice(index, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return class BookLoader extends Component {
|
return class multiSelect extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
let { selectDisabled, data } = props,
|
let { selectDisabled, data } = props,
|
||||||
|
@ -39,6 +39,25 @@ export default function multiSelect(Table) {
|
||||||
data: this.props.data
|
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 = () => {
|
onAllCheckChange = () => {
|
||||||
let self = this;
|
let self = this;
|
||||||
let listData = self.state.data.concat();
|
let listData = self.state.data.concat();
|
||||||
|
|
Loading…
Reference in New Issue