primereact
primereact copied to clipboard
DataTable: Shift-Selection does not work on page 2+ with lazy loading enabled
Describe the bug
When having lazy and paginator active in a DataTable, selection of multiple rows with the shift key does not work on page 2 and after
Reproducer
https://stackblitz.com/edit/vyuvtbvc-aww9fm7b
System Information
(From Stackblitz:)
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
primereact: latest => 10.9.3
react: 18.3.1 => 18.3.1
Steps to reproduce the behavior
- Have a DataTable with lazy loading and paginator enabled.
- Go to page 2
- Click on a row
- Hold shift and press on another row
Expected behavior
Shift-selection should work
There is some mismatch with the row indices when using both, lazy and paginator. I think it is a good idea to have the row indices behave the same way as in the non-lazy variant. So there are two options in my opinion:
- Increase the size of
processedDatasuch thatselectRangefinds the entries where it believes them to be or - adjust
rangeStartandrangeEndinselectRange. I think the 2nd option would be the best.
I have not looked at the implications for cell selection yet, though.