AllenFang / AllenFang/react-bootstrap-table

selectedRowKeys: weird behavior

オープン
#1,935 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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 はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。