AllenFang / AllenFang/react-bootstrap-table
selectedRowKeys: weird behavior
- 主要語言
- JavaScript
- 星號
- 2.2k
- 分支
- 761
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I had an issue with pagination, my requirment is whenever page change happens I need to clear all selected rows.
For this I tried using onPageChange(page, sizePerPage) method. In this method I wrote:
this.refs.table.setState({
selectedRowKeys: []
});
Now while testing I observed something wierd. Consider the following scenario
On page1 I selected 2 records, navigated to page2, here I selected 1 record, Now I used this.refs.table.state.selectedRowKeys and this gave me 3 ids, 2 from page1 and 1 from page2.
Ideally it should have given only 1 record from current page.
Can you please explain why this is happening.
There is one more scenario that occurred
If for a table I have a set of data X, in this data i select 2 rows, after selecting two rows I refresh the data in the grid. Now this grid shows a completely different set of data Y. In this Y set of data I select 3 rows.
Now for this table, this.refs.table.state.selectedRowKeys gives total of 5 records 2 from X set and 3 from Y set.
Is this an issue or this is how it works?
**Basically what I want is that my selected rows should be cleared when the data set changes.**
FYI I am using react bootstrap table version 4.3.1
PS: this is somewhat related to #1533
Thanks
貢獻指南
評估
這個 Issue 還沒有評估資料。