AllenFang / AllenFang/react-bootstrap-table

selectedRowKeys: weird behavior

Ouverte
#1,935 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
2.2k
Forks
761
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.