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] Row selection does not preserve when clearing header filters #14894

Closed
Marioblancocid opened this issue Oct 9, 2024 · 6 comments
Closed
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Filtering on header Related to the header filtering (Pro) feature feature: Selection Related to the data grid Selection feature status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it

Comments

@Marioblancocid
Copy link

Marioblancocid commented Oct 9, 2024

Steps to reproduce

BUG on 7.19: https://codesandbox.io/p/sandbox/datagridpro-7-19-ym3mmw
Example working on 7.18: https://codesandbox.io/p/sandbox/datagridpro-7-18-nfgqhc

Current behavior

After updating to 7.19, if you have a selected row and you try to search something that doesn't exist on the rows through a headerFilter (I have a custom one), and then you clear that filter, you realise that you lost your selection.
image
image
image

Expected behavior

It shouldn't lose its selected row as it happens on previous versions like 7.18 https://codesandbox.io/p/sandbox/datagridpro-7-18-nfgqhc

Context

No response

Your environment

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

Search keywords: bug,grid,mui,x,headerfilters,header,filters

@Marioblancocid Marioblancocid added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 9, 2024
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Oct 9, 2024
@michelengelen
Copy link
Member

@MBilalShafi this is likely related to #13757 ... could you have a look?

@michelengelen michelengelen changed the title [BUG] Data Grid Pro 7.19 - Header Filters [data grid] Row selection does not preserve when clearing header filters Oct 9, 2024
@michelengelen michelengelen added feature: Selection Related to the data grid Selection feature feature: Filtering on header Related to the header filtering (Pro) feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 9, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Oct 11, 2024
@michelengelen
Copy link
Member

I added it to the board so we don't lose track of this.

@MBilalShafi MBilalShafi self-assigned this Oct 11, 2024
@MBilalShafi
Copy link
Member

MBilalShafi commented Oct 11, 2024

Hey @Marioblancocid, this is an expected behavior introduced in v7.19 to fix a bug, here's the relevant PR: #14677

You could opt out of this behavior by passing keepNonExistentRowsSelected prop but it might not work great in combination with checkboxSelectionVisibleOnly prop or "row selection propagation" feature.

Here's the updated demo where the selection is kept: https://codesandbox.io/p/sandbox/datagridpro-7-19-forked-zlhtc4

Let me know if it resolves your concern.

@MBilalShafi MBilalShafi added status: waiting for author Issue with insufficient information status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it and removed bug 🐛 Something doesn't work labels Oct 11, 2024
@MBilalShafi MBilalShafi removed their assignment Oct 11, 2024
@Marioblancocid
Copy link
Author

Perfectly working with the keepNonExistentRowsSelected prop!

Thank you so much and sorry for tagging it as a bug.

I really appreciate the help!

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Oct 11, 2024
@MBilalShafi
Copy link
Member

Great, I'll consider the issue resolved in that case.
Feel free to comment if you have further questions on the same topic or open a new one if on another topic.

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@Marioblancocid How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 11, 2024
@MBilalShafi MBilalShafi moved this from 🆕 Needs refinement to ✅ Done in MUI X Data Grid Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Filtering on header Related to the header filtering (Pro) feature feature: Selection Related to the data grid Selection feature status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it
Projects
Status: Done
Development

No branches or pull requests

3 participants