Comments (7)
Thanks. I'm in the process of trying to filter out some stuff right now. It was much smaller when it started but the revisions things grew. Thanks again for your assistance. I think the confusion is this has so much code from the changes and no deletions.
from mui-x.
When receiving the state from localStorage
is it in JSON format. You have to parse this to apply it with apiRef.current.restoreState()
. Example:
if (apiRef.current && stateFromLocal) {
apiRef.current.restoreState(JSON.parse(stateFromLocal));
}
After that change it will work!
from mui-x.
Thanks this is working. 1 other question, how do I get the list of saved stated to update in the dropdown once I delete 1.
from mui-x.
You have implemented a reducer for that... at least it does look like it.
Think of the reducer as your internal state. Now on unmounting the component (or navigating away) you should store the current reducer state to localStorage and retrieve it once you mount the component or navigate back to it.
But the details of this implementation are up to you and a good place to ask these kinds of questions would be StackOverflow. The community there can help you with that problem.
If the original issue is resolved please feel free to close the issue. Thanks! 🙇🏼
from mui-x.
Thanks, I thought that the support purchased was to assist with questions such as these. Sorry to trouble you.
from mui-x.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.
How did we do @lisaWriteJava?
Your experience with our support team matters to us. If you have a moment, please share your thoughts through our brief survey.
from mui-x.
Thanks, I thought that the support purchased was to assist with questions such as these. Sorry to trouble you.
Typically you would be right, but the question you asked is unrelated to our components and more of a general react question. We do provide a demo on how to store and restore state from localStorage
. With a slight variation on this you should be able to implement the desired behavior. Just use the methods described there and change the "point of contact" as well as the data flow to when you initialize/mount (and later unmount) your reducer.
Basically the place where you pass in DEMO_INITIAL_STATE
you need to pass in the state you retrieved from localStorage
.
Now for deletion you just need to update the List you pass the state from the reducer instead of the one from localStorage
{Object.keys(state).map((label, index) => (
<ViewListItem
label={label}
index={index}
onDelete={handleDeleteView}
onSelect={() => handleSetActiveView(label, index)}
/>
))}
This should be enough to fix the problem. You should think about separating the code as well. it is hard to navigate like this. Just as a tip! 👍🏼
from mui-x.
Related Issues (20)
- [charts] Support color scale legend HOT 1
- [charts][docs-infra] Document interfaces in dedicated pages
- [data grid] Full-featured CRUD not editing data retrieved from database HOT 3
- [data grid] How to handle nullable values for singleSelect columns? HOT 4
- [data grid] how to filter based on raw row data HOT 6
- With date-fns adapter, date picker date formatting for days of month < 10 always has zero padding, even when format specifies otherwise. HOT 2
- [data grid] position: absolute for rows to avoid repaint HOT 1
- [data grid] Incorrect class name rendered to GridToolbarQuickFilter when customized with GridToolbarContainer HOT 2
- [data grid] Time spend rendering Emotion/Pigment CSS HOT 2
- [pickers][DateTimePicker] not showing 2 in the hour category, but shows 3 twice and the first isn't selectable HOT 10
- [pickers] Date Picker style lost in prod env when loading `SEEK API` script HOT 1
- [datagrid] Performance: event-based reactivity
- [data grid] Use autocomplete in renderHeaderFilter HOT 1
- [data grid] useResizeContainer Console Error when wrapping <div> is modified HOT 1
- [pickers] How to remove leading 0 from TimePicker? HOT 3
- [data grid] Parameters needed for custom column resize. HOT 4
- [data grid] How to override HIDE ALL panel button ? HOT 4
- [data grid] inconsistent rows with server side filterig HOT 5
- [data grid] Entering in edit mode, reload column configuration HOT 3
- [charts] Composition demos/ejection
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.