-
-
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
[TreeView] Automatic parents and children selection #14899
[TreeView] Automatic parents and children selection #14899
Conversation
Deploy preview: https://deploy-preview-14899--material-ui-x.netlify.app/ Updated pages: |
} from './useTreeViewSelection.types'; | ||
import { UseTreeViewItemsSignature } from '../useTreeViewItems'; | ||
|
||
function getCheckboxStatus({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would benefit from a selector when available
e4fa7c8
to
e7d88d4
Compare
@@ -75,25 +75,36 @@ Use the `onItemSelectionToggle` prop if you want to react to an item selection c | |||
|
|||
{{"demo": "TrackItemSelectionToggle.js"}} | |||
|
|||
## Parent / children selection relationship | |||
## Automatic parents and children selection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically a copy paste of the grid doc
If we modify this one, I'd be in favor of having Sam check the changes and apply the same to the grid one.
* | ||
* @default { parents: false, descendants: false } | ||
*/ | ||
selectionPropagation?: TreeViewSelectionPropagation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the doc, it's a copy paste of the grid JSDoc
48702ae
to
6889bc1
Compare
6889bc1
to
a0e4c41
Compare
@flaviendelangle Thank you for the amazing work. I have one question: If the parent checkbox is in an indeterminate state and the user checks it, shouldn’t the first click select all the children, and the second click uncheck all of them along with the parent? |
Hey @Kavan72, thanks for the feedback The action when clicking on an indeterminate parent was the source of a lot of debate over on the Data Grid. /**
* If `select`, a group header checkbox in indeterminate state (like "Select All" checkbox)
* will select all the rows under it.
* If `deselect`, it will deselect all the rows under it.
* Works only if `checkboxSelection` is enabled.
* @default "deselect"
*/
indeterminateCheckboxAction?: 'select' | 'deselect' On the Tree View, I followed the default behavior of the grid. |
That would be great feature 🙂 |
Issue created: #14979 Given the low complexity of the topic, I suspect that we should be able to ship that a few weeks after the main PR (depending on the bandwidth we have) |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Hi. I noticed that in the preview docs the bot linked, this feature works, but it does not in the live docs. Was there a regression? Has this simply not been released yet? (Our support key is 65425) |
Hi, This feature is part of the v8 alpha (which is deployed here). |
No rush to review this PR since it's not for v7, breaking change preparations on the pickers are more pressing 🙏
Apply #13757 for the Tree View
Closes #12883
Doc preview
Thanks to @MBilalShafi for all the work on the Data Grid feature, porting it to the Tree View is a piece of cake now 🙏
There is a super small BC on the legacy
TreeItem
, I propose to keep the feature for the alpha, it will be the main new feature for the Tree View in the stablefor people without big datasets.useTreeItem2
touseTreeViewSelection.itemPlugin
(it's becoming quite large with the indeterminate support)