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

[MUI Data Grid Pro] Tree collapses all groups when the rows are updated via props #9101

Open
2 tasks done
iboJoz opened this issue May 24, 2023 · 5 comments
Open
2 tasks done
Labels
component: data grid This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation plan: Pro Impact at least one Pro user

Comments

@iboJoz
Copy link

iboJoz commented May 24, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

After migrating MUI-X from 5 to 6 the Data Grid (with TreeData) collapses all groups when the rows are updated via props.
In MUI-X 5.17.26 the problem does not occur.
Before (MUI-X 5.17.26)
After (MUI-X 6.5.0)

Current behavior 😯

If the records of a Data Grid (with TreeData) are updated via the prop rows, then all groups are collapsed.

Expected behavior 🤔

The state if a row is collapsed or expanded should be kept. The documentation says: "The simplest way to update the rows is to provide the new rows using the rows prop. It replaces the previous values." (https://mui.com/x/react-data-grid/row-updates/).

Context 🔦

After saving the changes, the new records are returned from the server. The records are then passed to the DataGrid via the prop rows. This will then collapse all currently expanded groups.

Your environment 🌎

I use the chrome browser version (113.0.5672.127)

npx @mui/envinfo
  System:
    OS: Windows 10 10.0.22621
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 8.14.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.22621.1702.0), Chromium (112.0.1722.48)
  npmPackages:
    @emotion/react: ^11.10.5 => 11.10.5 
    @emotion/styled: ^11.10.5 => 11.10.5 
    @mui/base:  5.0.0-alpha.125 
    @mui/core-downloads-tracker:  5.12.0 
    @mui/icons-material: ^5.10.16 => 5.10.16 
    @mui/material: ^5.12.0 => 5.12.0
    @mui/private-theming:  5.12.0
    @mui/styled-engine:  5.12.0
    @mui/system:  5.12.0
    @mui/types:  7.2.4
    @mui/utils:  5.13.1
    @mui/x-data-grid:  6.5.0
    @mui/x-data-grid-pro: ^6.5.0 => 6.5.0
    @mui/x-license-pro:  6.0.4
    @types/react: 18.0.20 => 18.0.20
    react: 18.2.0 => 18.2.0
    react-dom: 18.2.0 => 18.2.0
    typescript: ~4.8.2 => 4.8.4

Order ID or Support key 💳 (optional)

57572

@iboJoz iboJoz added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 24, 2023
@zannager zannager added component: data grid This is the name of the generic UI component, not the React module! plan: Pro Impact at least one Pro user labels May 24, 2023
@romgrk
Copy link
Contributor

romgrk commented May 24, 2023

@MBilalShafi I haven't looked at the row grouping code a lot yet, could you take this one?

@MBilalShafi
Copy link
Member

Sure @romgrk.
@iboJoz The issue seems similar to #7771 and also been asked in #8676
Can you check #7771 (comment) and the discussion following it, if it makes sense to you?

@MBilalShafi MBilalShafi added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 24, 2023
@iboJoz
Copy link
Author

iboJoz commented May 25, 2023

@MBilalShafi Using the updateRows method would also work for us. But it is just not intuitive that the status of the expanded groups is removed, but other statuses (for example selection) remain. Maybe an update of the documentation (https://mui.com/x/react-data-grid/row-updates/#the-rows-prop) would be helpful, because it says that only the previous values are updated.

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label May 25, 2023
@MBilalShafi
Copy link
Member

Probably we can elaborate more on this portion of the docs a bit.

@MBilalShafi MBilalShafi added the docs Improvements or additions to the documentation label May 26, 2023
@yaredtsy
Copy link
Contributor

yaredtsy commented Jun 2, 2023

@MBilalShafi there is another issue related to this at #9002.

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! docs Improvements or additions to the documentation plan: Pro Impact at least one Pro user
Projects
None yet
Development

No branches or pull requests

5 participants