Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable with Virtual Scroller and Multiselect; onSelectionChanged provides incorrect selections and [...undefined, undefined, ...] #6791

Closed
nikcich opened this issue Jun 25, 2024 · 2 comments · Fixed by leoo1992/GeradorQRCode#57 or #6985 · May be fixed by nhattpn/BTL_LTNC#56
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@nikcich
Copy link

nikcich commented Jun 25, 2024

Describe the bug

This is sort of 2 problems, both related to the Shift+Click row selection.

  1. Incorrect selections being provided onSelectionChange
    • Click selecting one row, followed by scrolling and shift+clicking another to select all elements between. In my example I select row 0 and shift+click row 150, which the onSelectionChange callback shows as selecting 151 total rows (correct) but with rows 80-231 instead of 0-150. See the video below.
2024-06-24.19-07-56.mp4
  1. Selections provided onSelectionChange include numerous undefined rows.
    • I am assuming this has something to do with the virtual scroller. Similar to the first issue described, I am selecting row, then scrolling down and shift+click selecting another. This often results in a number of the selected rows returned in the onSelectionChange callback being undefined. See the video below.
2024-06-24.19-08-59.mp4

I have also seen both of these issues happen together (I believe the second video shows this)

Reproducer

https://stackblitz.com/edit/vitejs-vite-to2pri?file=src%2FApp.jsx

PrimeReact version

10.6.5

React version

18.x

Language

ES6

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Click select a row (e.g. the row 0)

  2. Scroll down a number of "pages" so the virtual scroller loads more data

  3. Shift+Click to select up to and including another row (e.g. row 150)

  4. Observe the console.log values and what is visually shown as being selected in the table

Expected behavior

I would expect the onSelectionChanged callback to return an accurate list of selected rows, and not to have any rows undefined.

@nikcich nikcich added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 25, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jun 25, 2024
@sja-cslab
Copy link
Contributor

Same as #5870 ?

@nikcich
Copy link
Author

nikcich commented Jun 25, 2024

I saw that issue (5870) prior to submitting this one. Definitely a similar problem. At the very least, my issue has the added fact that it selects incorrect rows in addition to others being undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
3 participants