AllenFang / AllenFang/react-bootstrap-table

selectedRowKeys: weird behavior

Aperta
#1,935 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
2.2k
Fork
761
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.