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

[data grid] Checkbox selection is keeping selection when filtering #11726

Closed
experimarketing opened this issue Jan 17, 2024 · 6 comments · Fixed by #11751
Closed

[data grid] Checkbox selection is keeping selection when filtering #11726

experimarketing opened this issue Jan 17, 2024 · 6 comments · Fixed by #11751
Assignees
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature feature: Selection Related to the data grid Selection feature

Comments

@experimarketing
Copy link

experimarketing commented Jan 17, 2024

Steps to reproduce

Link to live example: (required): https://codesandbox.io/p/sandbox/relaxed-knuth-npz6j7

Steps:

  1. Click the checkbox in the top left to select all 10 items.
  2. Apply a filter to filter for 2-3 items.
  3. Uncheck the checkbox to unselect all items.
  4. Check the checkbox again.

Current behavior

It selects items which don't pass the filter criteria.

Expected behavior

After you have applied the filter, cleared the checkboxes, and check them again, it should only select the filtered items.

That is the default behavior. But it seems to be an issue if apply the checkbox before the filter.

Context

It just provides an inconsistent experience, which could introduce errors if someone doesn't notice that more is selected than filtered.

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: datagrid checkbox selection
Order ID: 73295

@experimarketing experimarketing added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 17, 2024
@michelengelen
Copy link
Member

Hey @experimarketing and thanks for raising this issue.
It is indeed incorrect behavior, so I will put this on eon the board so that we can fix this.
Thanks again! 🙇🏼

@michelengelen michelengelen added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature feature: Selection Related to the data grid Selection feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 18, 2024
@michelengelen michelengelen changed the title Checkbox Selection Filter Issue [data grid] Checkbox selection is keeping selection when filtering Jan 18, 2024
@jyash97
Copy link

jyash97 commented Jan 19, 2024

@michelengelen can I take a look at this issue ?

@g1mishra
Copy link
Contributor

g1mishra commented Jan 19, 2024

@jyash97, I've already addressed and fixed the issue. If it's acceptable, may I proceed with this resolution?

My apologies for not providing an update before picking it up @michelengelen

@michelengelen
Copy link
Member

@g1mishra feel free to open a PR with your solution. Looking forward to it!

@experimarketing
Copy link
Author

Just one update on this that I noticed when I was using it again. This is likely the same issue, but wanted to mention this reproduction of the issue.

Steps:

  1. Click the checkbox in the top left to select all 10 items.
  2. Apply a filter to filter for 3 items.
  3. Uncheck the checkbox to unselect all items.

The selection model now contains 7 rows selected, when it should have none selected.

Copy link

⚠️ This issue has been closed.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.

How did we do @experimarketing?
Your experience with our support team matters to us. If you have a moment, please share your thoughts through our brief survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature feature: Selection Related to the data grid Selection feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants