[DataGrid] Support column density when storing/restoring state
- [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
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)
there should be an onDensityChange handler in options.
We should always build features with
- a model
- onModelChange handler
@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.
Can we extend the current "restore state" behavior to support the column Density? cc @flaviendelangle
-> Shown columns state is already supported.
Duplicates https://github.com/mui/mui-x/issues/4572