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: Sort with multiselect - wrong selection #7468

Closed
sja-cslab opened this issue Dec 2, 2024 · 2 comments · Fixed by #7492
Closed

Datatable: Sort with multiselect - wrong selection #7468

sja-cslab opened this issue Dec 2, 2024 · 2 comments · Fixed by #7492
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@sja-cslab
Copy link
Contributor

sja-cslab commented Dec 2, 2024

Describe the bug

If we combine multiselect with sorting, selection no longer works as expected. The array we receive in onSelectionChange contains the elements that would be at those indices if sorting were not applied.

This

Reproducer

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

System Information

PrimeReact 10.8.5

happens in 10.8.4 too.

Steps to reproduce the behavior

  1. Go to Stackblitz
  2. (optional) selection is working as expected via metakey and via dragselection
  3. (optional) unselect all
  4. sort column
  5. try to multiselect the first few items

The result will be the selected items (the number is correct), but the selected items will be those that would have been selected if no sorting had been applied.

Expected behavior

Receiving the correct items in onSelectionChange

@sja-cslab sja-cslab added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 2, 2024
@sja-cslab sja-cslab changed the title Datatable: Sort with multiselect - wrong/no selection Datatable: Sort with multiselect - wrong selection Dec 2, 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 Dec 2, 2024
@tneeraja95
Copy link
Contributor

Not able to reproduce this issue.
Sorted the column and after that selected some rows. Correct rows are selected.
Screenshot 2024-12-04 at 5 43 08 PM

Can you share a screenshot of your output where multiselect is wrong.

@sja-cslab
Copy link
Contributor Author

sja-cslab commented Dec 4, 2024

@tneeraja95 It's important to use meta-key or mouse multiselect. Multiple single selection work as expected.

record_primereact_7468.mp4

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
Development

Successfully merging a pull request may close this issue.

3 participants