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] Bug when initializing selection with row grouping and rowSelectionPropagation #15382

Closed
M-sleeper opened this issue Nov 12, 2024 · 3 comments · Fixed by #15461
Closed
Assignees
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Row grouping Related to the data grid Row grouping feature feature: Selection Related to the data grid Selection feature support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@M-sleeper
Copy link

M-sleeper commented Nov 12, 2024

Steps to reproduce

Link to live example: https://codesandbox.io/p/sandbox/lucid-snow-58c6ld

Steps:

  1. Open the group of "20th Century Fox"
  2. Open "James Cameron"

Current behavior

All the children of group "James Cameron" are selected, the group's checkbox is in the intermediate state.

Expected behavior

Having

rowSelectionPropagation={{ parents: true, descendants: true }}

I would expect the checkbox of group "James Cameron" is selected. The docs says:

Selecting all the filtered descendants of a parent selects the parent automatically

https://mui.com/x/react-data-grid/row-grouping/#automatic-parents-and-children-selection

Deselecting and selecting one of the children makes the parent selected as expected.

Maybe there's a race condition during loading the table.

Context

No response

Your environment

npx @mui/envinfo
System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
  Binaries:
    Node: 18.19.1 - /usr/bin/node
    npm: 9.2.0 - /usr/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 130.0.6723.116
  npmPackages:
    @emotion/react: ^11.13.3 => 11.13.3 
    @emotion/styled: ^11.13.0 => 11.13.0 
    @mui/core-downloads-tracker:  6.1.6 
    @mui/icons-material: ^6.1.6 => 6.1.6 
    @mui/material: ^6.1.6 => 6.1.6 
    @mui/private-theming:  6.1.6 
    @mui/styled-engine:  6.1.6 
    @mui/system:  6.1.6 
    @mui/types:  7.2.19 
    @mui/utils:  6.1.6 
    @mui/x-charts: ^7.22.1 => 7.22.1 
    @mui/x-charts-vendor:  7.20.0 
    @mui/x-data-grid:  7.22.1 
    @mui/x-data-grid-premium: ^7.22.1 => 7.22.1 
    @mui/x-data-grid-pro:  7.22.1 
    @mui/x-date-pickers:  7.22.1 
    @mui/x-date-pickers-pro: ^7.22.1 => 7.22.1 
    @mui/x-internals:  7.21.0 
    @mui/x-license:  7.21.0 
    @mui/x-tree-view: ^7.22.1 => 7.22.1 
    @types/react:  18.3.12 
    react: 18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 

Search keywords: rowSelectionPropagation datagrid row grouping
Order ID: 101072

@M-sleeper M-sleeper added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 12, 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 Nov 12, 2024
@michelengelen
Copy link
Member

@MBilalShafi this seems to be a bug ... I would reckon this is due to the order of recursive execution. On the other hand there is also a bug when selecting all children withe automatic parent selection enabled that the root parent does not get selected and keeps its indeterminate state.

I'll add this to the board for now. 👍🏼

@michelengelen michelengelen added feature: Selection Related to the data grid Selection feature feature: Row grouping Related to the data grid Row grouping feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 12, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Nov 12, 2024
@michelengelen michelengelen changed the title [Datagrid] Bug when initializing selection with row grouping and rowSelectionPropagation [data grid] Bug when initializing selection with row grouping and rowSelectionPropagation Nov 12, 2024
@MBilalShafi
Copy link
Member

MBilalShafi commented Nov 12, 2024

We skipped running the selection propagation scan on the initial render to solve another bug.

if (isFirstRender.current) {
return;
}

I guess we'll have to run it when the selectionModel is initialized.

@MBilalShafi MBilalShafi self-assigned this Nov 12, 2024
@MBilalShafi MBilalShafi moved this from 🆕 Needs refinement to 🔖 Ready in MUI X Data Grid Nov 12, 2024
@MBilalShafi MBilalShafi moved this from 🔖 Ready to 👀 In review in MUI X Data Grid Nov 18, 2024
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

@M-sleeper 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.

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: Row grouping Related to the data grid Row grouping feature feature: Selection Related to the data grid Selection feature support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

3 participants