I set the default check box 13, the first submission is correct, the second time, the page also checked the last submission, not configured by getCheckboxProps rendering, and then onChange this, the output is the last submission (132) + this default (13) + new check (45) = [1, 3, 2, 1, 3, 4, 5]
I am puzzled.
class User extends Interval {
constructor(props) {
super(props);
this.state = {
synCode: [],
}
}
render() {
console.log(this.state.synCode);
const _this = this;
const rowSelection = {
getCheckboxProps(record) {
return {
defaultChecked: record.leader === 1, //
};
},
onChange(selectedRowKeys) {
console.log("",selectedRowKeys);
// console.log("",_this.state.synCode);
_this.setState({synCode: selectedRowKeys})
},
};
return (
<Table rowSelection={rowSelection} columns={columns} dataSource={this.state.data} />
);
}
}