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] apiRef restoreState and exportState does not support the density #4572

Closed
2 tasks done
vakha30 opened this issue Apr 19, 2022 · 15 comments · Fixed by #12671
Closed
2 tasks done

[data grid] apiRef restoreState and exportState does not support the density #4572

vakha30 opened this issue Apr 19, 2022 · 15 comments · Fixed by #12671
Labels
component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@vakha30
Copy link

vakha30 commented Apr 19, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

The density state is not saved. All other state is saved correctly

Expected behavior 🤔

No response

Steps to reproduce 🕹

Steps:

Context 🔦

No response

Your environment 🌎

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

Order ID 💳 (optional)

No response

@vakha30 vakha30 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 19, 2022
@flaviendelangle
Copy link
Member

Do you mean it is not saved when using apiRef.current.exportState ?
If so, yes we did not add it yet

@flaviendelangle flaviendelangle 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, 2022
@vakha30
Copy link
Author

vakha30 commented Apr 21, 2022

Yes, I meant it. Thanks

@github-actions
Copy link

Since the issue is missing key information, and has been inactive for 7 days, it has been automatically closed.
If you wish to see the issue reopened, please provide the missing information.

@flaviendelangle flaviendelangle added new feature New feature or request and removed status: waiting for author Issue with insufficient information labels Apr 29, 2022
@flaviendelangle
Copy link
Member

Oops forgot to remove the label

@flaviendelangle flaviendelangle changed the title Density state not saved [data grid] apiRef restoreState and exportState does not support the density Apr 29, 2022
@ithrforu
Copy link
Contributor

Hello, @flaviendelangle, i have the same problem. Do you know when density will be supported in apiRef.current.exportState? Thank you :)

@vaclav-slavik
Copy link

Hello, @flaviendelangle, i have the same problem. Do you know when density will be supported in apiRef.current.exportState? Thank you :)

Plus one. At the meantime, I'm using workaround (storing the user selected density separate from the rest of the datagrid state), but it would be great to have the support for it in the exportState and restoreState.

@flaviendelangle
Copy link
Member

flaviendelangle commented Oct 19, 2022

@joserodolfofreitas @m4theushw, I'm the only one notified so I'm adding you to the loop


I'm not working on the DataGrid anymore, but the team will have a look 👍

@rubenprodev
Copy link

Hi there, is there any news about it? An onDensityChange added to the catalog of events would be awesome!

@LironKiloma
Copy link
Contributor

Hey, I'm joining to the support of density save in the state, would be great to have it

@ArmandRedgate
Copy link

ArmandRedgate commented Dec 4, 2023

Hello all,

This issue is causing us pain at the moment, as our customers expect us to save their DataGrid preferences, but there is no way to do so with density specifically.

Our order ID is 65425.

In the end, we had to do the following ugly workaround:

  • Write and maintain our own version of the GridToolbarDensitySelector that uses externally managed state (getter and setter)
  • Detect user changes to that dropdown
  • Save those values to local storage separately from the rest of our GridInitialState data
  • Update via the density prop in DataGridPro

We've spent hours looking for another way of doing this, but it was our only option.

Like everyone else, we'd like to see density be properly supported in initialState, apiRef.current.exportState and apiRef.current.restoreState.

@flaviendelangle
Copy link
Member

flaviendelangle commented Dec 5, 2023

cc @cherniavskii
Adding it to your backlog

@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Dec 5, 2023
@flaviendelangle flaviendelangle moved this from 🆕 Needs refinement to 📋 Backlog in MUI X Data Grid Dec 5, 2023
@cherniavskii cherniavskii moved this from 📋 Backlog to 🆕 Needs refinement in MUI X Data Grid Dec 5, 2023
@jmcpeak
Copy link

jmcpeak commented Dec 19, 2023

Hello all,

This issue is causing us pain at the moment, as our customers expect us to save their DataGrid preferences, but there is no way to do so with density specifically.

In the end, we had to do the following ugly workaround:

  • Write and maintain our own version of the GridToolbarDensitySelector that uses externally managed state (getter and setter)
  • Detect user changes to that dropdown
  • Save those values to local storage separately from the rest of our GridInitialState data
  • Update via the density prop in DataGridPro

We've spent hours looking for another way of doing this, but it was our only option.

Like everyone else, we'd like to see density be properly supported in initialState, apiRef.current.exportState and apiRef.current.restoreState.

We are in the exact same boat. We did purchase 4 licenses of data-grid-pro. Anything else you need from me to help move it to the top of the backlog?

@brendonrapp
Copy link

Running into this limitation now as well. The idea of doubling the number of saved states that we're managing so that each table can have a separate density state maintained is unappealing. Feels like a weird omission in an otherwise uniform and easily-managed table state system.

@jmcpeak
Copy link

jmcpeak commented Feb 29, 2024

I'll try and get a PR out with a fix on Monday

@MBilalShafi MBilalShafi moved this from 🆕 Needs refinement to 👀 In review in MUI X Data Grid Apr 4, 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.

@vakha30: 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.

@cherniavskii cherniavskii moved this from 👀 In review to ✅ Done in MUI X Data Grid Jun 11, 2024
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! new feature New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

9 participants