Comments (4)
Hey @Chris-FSE you can save and restore the DataGrid
state with the apiRef
. There is a section about this in the docs.
The rows update re-rendering the grid and therefore resetting the column state is due to a misused column prop. These are constants and should be handled like that. You can either memoize the column definitions inside the component or just define them outside of the component.
I have updated the demo from the docs about the row updates to showcase that: demo.
from mui-x.
Hey @michelengelen thank you for your help.
Indeed, in the meantime I had found for my part by coming across examples of the use of states that the definitions of the columns must be outside the body of the component.
I think it would be interesting to notify this in the documentation.
Is this a library bug? Because even if the columns are defined in the component, the state management should work, right?
In my case I have very specific column renderings which depend on declared variables and managed only in the component body. So I will to memoized and see if it's work then, because it's not obvious...
from mui-x.
The memoize option also works like exporting the column definition out of the component.
Thanks again for the information.
This is better for me because the column definitions depend on component variables.
I'm just curious to know if it's a bug from the lib or not.
And I think that you can close the issue now.
from mui-x.
Right ... memoization is a different possibility.
I will close this now as the opening question seems resolved.
Feel free to reopen if you have follow up questions. 🙇🏼
from mui-x.
Related Issues (20)
- [data grid] Improve "Save and restore the state from external storage" demo HOT 18
- [data grid] Flickering on tab / panel change for data grid when using `flex` columns HOT 6
- [data grid] How can I display the number of filtered items in the footer? HOT 2
- [data grid] Event Propagation and Portal Challenges with DataGrid's GridActionsCellItem HOT 8
- DataGrid: Missing Page Size Options in Pagination HOT 2
- [data grid] Improved Toolbar
- [pickers] Improve `TimeClock` `ampmInClock` prop clarity HOT 1
- [DataGrid] How to have a column have different data types. In effect, flipping (transposing) the functionality of rows and columns HOT 8
- [charts] Horizontal bar chart tick labels are always cut off after 7 characters HOT 3
- [data grid] Overflow for rows HOT 6
- [question] Nesting MUI X Data Grid HOT 2
- [data grid] Support Density as a model (e.g. onDensityChange / DensityModel) rather than internal property HOT 2
- [DataGrid] Tree Data expand and collapse is tied to first column.
- [data grid] Tree Data expand and collapse is tied to first column. HOT 5
- [DatePicker] DatePicker behaves differently in UnitTesting HOT 2
- [pickers] using `disableOpenPicker` prop with responsive DatePicker shows no dates in mobile calendar dialog HOT 1
- [pickers] when using `clearable` field with DatePicker, selecting a date doesn't return focus to openPickerButton HOT 1
- Removed Watermark from DateRangePicker Component in MUI X (Pro) HOT 5
- [DateRangePicker] Date range is not highlighted properly with `AdapterLuxon` HOT 4
- [DataGrid] Notifications in full CRUD example HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.