gregnb / gregnb/mui-datatables

selection persists after changing page

Open
#1,663 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

in case of `options.serverSide: true` selecting a row then changing page will select the corresponding row on the next page if number of rows changed from the first page to the second.

most likely due to this condition https://github.com/gregnb/mui-datatables/blob/ca67aaeb1602b4585e145b361151ce62a8b2d3dd/src/MUIDataTable.js#L333

## Steps to Reproduce (for bugs)

1. run https://github.com/gregnb/mui-datatables/blob/master/examples/serverside-pagination/index.js changing `rowsPerPage` to 15.
2. select the first row of the first page.
3. go to next page.
4. the first row of the second page is selected by default!

## Expected Behavior
selected rows should be reset after changing page.

## Current Behavior
in case number of rows changed from a page to another the data change won't be detected and the corresponding rows of the same page will be selected.

## Your Environment
running an example included in the repo in chrome.

| Tech | Version |
|--------------|---------|
| MUI-datatables | 3.4.1 & master |
| browser | chrome |

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.