-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Please add edit example for treedata #15420
Comments
Hey @entaildevops ... That's a good request. The normal editing feature works though, so what exactly are you trying to accomplish? If you can explain your use case we might be able to help you with it. |
Good to hear that you´re going to create more examples, @michelengelen! However, I was able to solve the problem with collapsing rows: the problem was me using setRows() to update all rows within processRowUpdate, which caused the rows collapsing (just as the docs imply). The solution was to use apiRef.current.updateRows() to update only affected rows instead. Still, it would be helpful if the treedata example would include editing capabilities. |
Glad to hear that you could fix it on your own. I would have been able to point you to that as well if you had provided a reproduction example :P I'll keep that in mind for the next time. @mui/xgrid should we maybe encourage the use of |
I agree. People tend to copy/paste examples and go from there, so the "correct" way should be used as much as possible. At least I had been using DataGrid for a good while before I bumped into the fact that setRows() is NOT the recommended way to update your content. Yes, the correct way is is mentioned in the docs, but it is easy to miss I guess =) |
Related page
https://mui.com/x/react-data-grid/tree-data/
Kind of issue
Missing information
Issue description
It is currently quite unclear how row editing should be accomplished properly with treedata. If you the full featured crud example is modified to use treedata, the editing works - BUT: every edit causes the row to collapse, which is very bad UX. The collapsing occurs because the example uses processRowUpdate to handle updates. As stated here apiref.current.updateRows() would not cause this. But with a lack of example, it is a bit hard to get grasp on how to do it.
The Full example of treedata should have example also on how to properly edit the rows with decent UX when treedata is present.
Context
No response
Search keywords: treedata
The text was updated successfully, but these errors were encountered: