- I am using
ant design tablecomponent and I have selected rows. - I want
onClickreset selected rows. I can not find out where it stores selected rows.
const rowSelection = { onChange: (selectedRowKeys, rows) => { this.setState({ selectedRowsArray: [...rows] }); }, }; <Table rowSelection={rowSelection} columns={columns} dataSource={paymentsHistory} />
Any Idea how to clear selected rows?
Advertisement
Answer
rowSelection also takes selectedRowKeys property that will help you control the selected rows at any point in time.
const { selectedRowsArray } = this.state;
const rowSelection = {
selectedRowKeys: selectedRowsArray,
onChange: (selectedRowKeys, rows) => {
this.setState({
selectedRowsArray: [...rows]
});
},
};
<Table rowSelection={rowSelection} columns={columns} dataSource={paymentsHistory} />