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

Is it possible not to close previously opened groups when changing the data in useState? #11105

Closed
kharlaienko opened this issue Nov 20, 2023 · 2 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Tree data Related to the data grid Tree data feature plan: Premium Impact at least one Premium user status: waiting for author Issue with insufficient information support: commercial Support request from paid users

Comments

@kharlaienko
Copy link

kharlaienko commented Nov 20, 2023

The problem in depth 🔍

https://codesandbox.io/s/mui-treedata-update-9rpsvj?file=/src/Demo.js

Your environment 🌎

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

Order Id: 73714

Search keywords: datagrid,

@kharlaienko kharlaienko added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Nov 20, 2023
@kharlaienko kharlaienko changed the title Is it possible not to close previously opened groups when changing the date in useState? Is it possible not to close previously opened groups when changing the data in useState? Nov 20, 2023
@cherniavskii cherniavskii added component: data grid This is the name of the generic UI component, not the React module! plan: Premium Impact at least one Premium user labels Nov 21, 2023
@cherniavskii
Copy link
Member

Hey @kharlaienko

There are 2 options here.

  1. If you do not need row state for anything else except the Data Grid - you can skip updating it - the Data Grid will update the row anyway.
    https://codesandbox.io/p/sandbox/mui-treedata-update-forked-qrtf5t

  2. If you do need to keep track of the row state and it could potentially change from the outside - you will have to use the apiRef.current.updateRows method (see [data grid] Tree data expansion state is lost when data is updated in 6.0.0-beta.1 #7771 (comment) for more context).
    https://codesandbox.io/p/sandbox/mui-treedata-update-forked-qgdx8c

@cherniavskii cherniavskii added feature: Tree data Related to the data grid Tree data feature 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 Nov 21, 2023
Copy link

The issue has been inactive for 7 days and has been automatically closed. If you think that it has been incorrectly closed, please reopen it and provide missing information (if any) or continue the last discussion.

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: Tree data Related to the data grid Tree data feature plan: Premium Impact at least one Premium user status: waiting for author Issue with insufficient information support: commercial Support request from paid users
Projects
None yet
Development

No branches or pull requests

2 participants