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] is there a way to export datagrid state on unload event? #7876

Closed
2 tasks done
NareshMurthy opened this issue Feb 9, 2023 · 3 comments
Closed
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 feature: State management Related to the data grid State management feature plan: Pro Impact at least one Pro user support: commercial Support request from paid users

Comments

@NareshMurthy
Copy link

Order ID 💳

56539

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

The problem in depth 🔍

I have a data grid pro, and am trying to store the datagrid state on component unload event(user navigates to another page), and restore the datagrid state once the user comes back the page again.
Is there a recommended way to do this?

Thanks!

Your environment 🌎

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

Hi @NareshMurthy
We are going to add such a demo to our docs.
Here's a working example in the Codesandbox: https://codesandbox.io/s/suspicious-leftpad-k7v8te?file=/demo.tsx

@cherniavskii cherniavskii added docs Improvements or additions to the documentation component: data grid This is the name of the generic UI component, not the React module! feature: State management Related to the data grid State management feature plan: Pro Impact at least one Pro user and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 9, 2023
@NareshMurthy
Copy link
Author

NareshMurthy commented Feb 10, 2023

@cherniavskii Thanks this helped a lot
I tried this example, but the event fires only on page reload or url change.
I have a link which navigates to another component using react-router-dom, in that case the unload of datagrid component is not fired

@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Apr 19, 2023
@MBilalShafi MBilalShafi moved this from 🆕 Needs refinement to 🔖 Ready in MUI X Data Grid Sep 26, 2023
@michelengelen
Copy link
Member

Hey @NareshMurthy ... we recently added a recipe that handles your use-case. Check out this part of the docs: Save and restore the state from external storage.

I am closing this issue now as per the reasoning above! :shipit:

If this is not sufficient or when you have follow-up questions please feel free to re-open this issue and tag me! Glad to help you!

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 feature: State management Related to the data grid State management feature plan: Pro Impact at least one Pro user support: commercial Support request from paid users
Projects
Status: Done
Development

No branches or pull requests

3 participants