AllenFang / AllenFang/react-bootstrap-table

selectedRowKeys: weird behavior

Abierto
#1,935 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
2.2k
Forks
761
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.