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

Filtering with isRowSelectable and treeData results in a crash when a row is selected #15045

Closed
yoshegg opened this issue Oct 21, 2024 · 2 comments · Fixed by #15184
Closed
Assignees
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@yoshegg
Copy link

yoshegg commented Oct 21, 2024

Steps to reproduce

Link to live example: https://stackblitz.com/edit/react-ayw1zv-qxwdvx?file=Demo.js

Steps:

  1. Have a DataGrid with treeData={true} and isRowSelectable={() => true}.
  2. Select a row, for example the first.
  3. Filter the rows with one of the header filters, for example "Commodity". Make sure to filter in a way that the selected row would NOT be shown.

Current behavior

The page crashes with the following error:

Error in /turbo_modules/@mui/[email protected]/node/hooks/features/rows/useGridParamsApi.js (33:13)
No row with id #auto-generated-row-null/4bfc3018-3d32-513e-9913-5b81a56718a0 found

Expected behavior

The page should not crash and filter correctly.

Context

I'm aware that the error MUI X: The `filterMode="server"` prop is not available when the `treeData` is enabled. is logged. When not using isRowSelectable everything works fine though.

I want to select child rows in the DataGrid and keep that selection when using filters.

Currently, I bypass the issues by not setting isRowSelectable, but by providing a custom renderCell to my custom checkbox column that is mostly based on GRID_CHECKBOX_SELECTION_COL_DEF.

Your environment

npx @mui/envinfo
  System:
    OS: macOS 14.7
  Binaries:
    Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 130.0.6723.59
    Edge: Not Found
    Safari: 17.6
  npmPackages:
    @emotion/react: 11.13.3 => 11.13.3 
    @emotion/styled: 11.13.0 => 11.13.0 
    @mui/base:  5.0.0-beta.40 
    @mui/core-downloads-tracker:  5.16.7 
    @mui/icons-material: 6.1.4 => 6.1.4 
    @mui/joy: 5.0.0-beta.48 => 5.0.0-beta.48 
    @mui/material: 6.1.4 => 6.1.4 
    @mui/private-theming:  6.1.4 
    @mui/styled-engine:  6.1.4 
    @mui/system:  6.1.4 
    @mui/types:  7.2.18 
    @mui/utils:  5.16.6 
    @mui/x-data-grid: 7.21.0 => 7.21.0 
    @mui/x-data-grid-premium: 7.21.0 => 7.21.0 
    @mui/x-data-grid-pro:  7.21.0 
    @mui/x-date-pickers: 7.21.0 => 7.21.0 
    @mui/x-internals:  7.21.0 
    @mui/x-license:  7.21.0 
    @types/react: 18.3.11 => 18.3.11 
    react: 18.3.1 => 18.3.1 
    react-dom: 18.3.1 => 18.3.1 
    typescript:  5.5.4 

Search keywords: DataGrid isRowSelectable treeData filter
Order ID: 95669

@yoshegg yoshegg added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 21, 2024
@github-actions github-actions bot added component: data grid This is the name of the generic UI component, not the React module! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Oct 21, 2024
@KenanYusuf
Copy link
Member

KenanYusuf commented Oct 22, 2024

Hi @yoshegg. Thanks for providing the reproduction, @MBilalShafi is going to take a look at the issue with isRowSelectable.

@KenanYusuf KenanYusuf removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 22, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Oct 22, 2024
@KenanYusuf KenanYusuf moved this from 🆕 Needs refinement to 🔖 Ready in MUI X Data Grid Oct 22, 2024
@MBilalShafi MBilalShafi moved this from 🔖 Ready to 🏗 In progress in MUI X Data Grid Oct 22, 2024
Copy link

github-actions bot commented Nov 4, 2024

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

@yoshegg 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.

@cherniavskii cherniavskii moved this from 🏗 In progress to ✅ Done in MUI X Data Grid Dec 17, 2024
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! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants