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

[DataGridPro] Keep row children expansion state on CRUD operation #8676

Closed
2 tasks done
taiwoladipo opened this issue Apr 19, 2023 · 2 comments
Closed
2 tasks done

[DataGridPro] Keep row children expansion state on CRUD operation #8676

taiwoladipo opened this issue Apr 19, 2023 · 2 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! support: commercial Support request from paid users

Comments

@taiwoladipo
Copy link

Order ID or Support key 💳 (optional)

2950157729

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

The problem in depth 🔍

I am implementing a CRUD use case for the tree data. If a row is expanded while a new child row is created, the new row is created but the parent row gets collapsed. With a huge dataset it makes it difficult to track where the new row was inserted.
I have tried to programatically toggle the expansion using apiRef.current.setRowChildrenExpansion(id, true) with no luck. Can you advise on how to achieve this?

Steps to reproduce
Link to live example: https://codesandbox.io/s/thirsty-matan-k00vn4?file=/src/TreeData.tsx
Reproducible on Chrome and Safari.

  1. Click the plus icon on the US row.
  2. Expand the US row to see the inserted row.

Expected behaviour
The US row should remain expanded after the new row is inserted.

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@taiwoladipo taiwoladipo added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Apr 19, 2023
@MBilalShafi
Copy link
Member

The issue seems similar to #7771
Can you check this comment and see if it could be a potential fix for you?

@MBilalShafi MBilalShafi added component: data grid This is the name of the generic UI component, not the React module! 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 Apr 20, 2023
@taiwoladipo
Copy link
Author

Yes, updateRows preserves the expansion state. Thanks for the suggestion.

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! support: commercial Support request from paid users
Projects
None yet
Development

No branches or pull requests

2 participants