-
-
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
[tree view][RichTreeView] Checkbox parent child interactions don't work when checking and unchecking child nodes #15989
Comments
This is arguable. There are scenarios where you want that behavior. Think about you want to move the children out of the parent. If you always select the parent when selecting all children this is impossible. I know that we recently added new parent-children selection behavior in the data grid and added a bit of customizability around it. I think we also planned to implement the same thing in the tree view component, but am not sure how far this is gone until now. @noraleonte would you know more? |
Hey there @reese1515 👋
If Oh, this is a feature released in v8 alpha cc. @michelengelen |
@noraleonte Sorry about the link not working. If you go to https://mui.com/x/react-tree-view/rich-tree-view/selection/#parent-children-selection-relationship and open the example in Parent / children selection relationship you'll see what I mean. @michelengelen The documentation on https://mui.com/x/react-tree-view/rich-tree-view/selection/#parent-children-selection-relationship under the header Parent / children selection relationship states what I'm describing to be the expected behavior. What you described as a counter example with moving children outside of the parent I would argue is a special case. I also found it interesting that the documentation says "This feature isn't implemented yet. It's coming. 👍 Upvote issue #4821 if you want to see it land faster. Don't hesitate to leave a comment on the same issue to influence what gets built. Especially if you already have a use case for this component, or if you are facing a pain point with your current solution." However when you go to that issue its completely unrelated to the parent child relationship with respects to checking and unchecking and instead has to do with Drag and Drop. |
@reese1515 You should be able to use the built-in selection propagation feature starting with v8 which is currently in alpha. You can find the documentation for that on https://next.mui.com/x/react-tree-view/rich-tree-view/selection/#automatic-parents-and-children-selection. |
@noraleonte Thank you this is exactly what I was looking for. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @reese1515 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Sry @reese1515 I forgot to mention before that this is not part of v7, but the current alpha for v8. 🙇🏼 That's where the confusion came from! My bad! |
Steps to reproduce
Steps:
Current behavior
Checking and unchecking child nodes does not update the parents checked state
Expected behavior
The parent node does not reflect the checked state of its children.
If the parent is checked and a child becomes unchecked the parent should become unchecked
If you check all the children under a parent the parent should become checked
Even functionality like what's seen in https://www.npmjs.com/package/react-checkbox-tree with a grayed out checked parent would be nice. After unchecking children if you then collapse the tree, knowing which parents have all their children checked vs which only have some checked would be nice.
Context
No response
Your environment
npx @mui/envinfo
Search keywords: Rich Tree View
The text was updated successfully, but these errors were encountered: