There is a bug when selecting the data on the first page and then selecting the data on the second page, the data on the first page will be emptied.
Solution: Manually save the selected data
nameSelectChange = (selectedRowKeys, newSelectedRows) => {
letoldRows = this.state.nameSelectedRows; NewSelectedRows. Length > 0 && newSelectedRows. Map (p=>{if( oldRows[p.id] === undefined){ oldRows[p.id] = p; }}); // Filter the data that exists in the key when deleting dataletnewRows = {}; selectedRowKeys.map( p=>{ newRows[p] = oldRows[p]; }); this.setState({ nameSelectedKeys: selectedRowKeys, nameSelectedRows: newRows }, ()=>{letV = {selectedRowKeys, nameRows: object. values(newRows) // Turn objects into arrays}; // Pass to the parent component and save this.props. SelectedNames (v); }); };Copy the code
I have not used this method, the back end with a record through the ID interface to obtain
See the source link for more
Source: www.jianshu.com/p/51b515bbc…