mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[DataGrid] Support column density when storing/restoring state

Open Neonin opened this issue 5 years ago • 5 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

I would like to be able to save the row density state and display the visible columns 🙏, saving their state somewhere and not losing it after page reloads. There is a prop for density, but there is no callback in the documentation. I also tried digging around and subscribing to the apiRef events, but unfortunately, I couldn't find that either.😢

Examples 🌈

There is already a density or hide in columns - present as part of the table but need to expose those as event handlers.

Motivation 🔦

This will help users customize the view of the table , because when we reload the page, we still show the same view.

Order id 💳

19652

Neonin avatar Apr 19 '21 13:04 Neonin

It looks like a duplicate of #820. Would it work for you if the whole state of the grid is persisted? (instead of having to cherry-pick each state)

oliviertassinari avatar Apr 19 '21 14:04 oliviertassinari

there should be an onDensityChange handler in options. We should always build features with

  1. a model
  2. onModelChange handler

dtassone avatar Apr 19 '21 15:04 dtassone

@dtassone Then, it's also related to #190 since it's at the core of the pain. I don't think any solution should be preferred yet, as the need for dozens of controllable props vs. different options haven't be resolved yet in this thread.

oliviertassinari avatar Apr 19 '21 15:04 oliviertassinari

Can we extend the current "restore state" behavior to support the column Density? cc @flaviendelangle

-> Shown columns state is already supported.

joserodolfofreitas avatar Jun 29 '22 09:06 joserodolfofreitas

Duplicates https://github.com/mui/mui-x/issues/4572

flaviendelangle avatar Jun 29 '22 10:06 flaviendelangle