-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
bug(MatTree): expandAll() only expand the first level #29865
Comments
Can this be fixed please? |
This is still relevant as of today |
Hello! I ran into the same problem when switching to the new api cdk tree; I used to use treeControl.expandAll() / collapseAll() without problems; My version of angular cdk: 18.2.11, but I see the same logic I'll describe below in 19.0.4 as well:
line map(nestedNodes => (this.isExpanded(node) ? nestedNodes : [])), is key and we can see from the description that it's intentional:
and unfortunately, we can't use expandAll/collapseAll as it was before - they work only for first level. in contrast to the old logic:
dataNodes were filled and have nested children. Please, could you please look at this and make changes? Because the expandAll function doesn't do what it promises to do. @crisbeto (I see from the git history that you often work with tree, if you don't deal with such issues, I apologize for bothering you, but maybe you know someone who does) |
Fixes that the tree wasn't recursing down and expanding all child nodes when calling `expandAll`. Fixes angular#29865.
Fixes that the tree wasn't recursing down and expanding all child nodes when calling `expandAll`. Fixes #29865.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Is this a regression?
The previous version in which this bug was not present was
17.x
Description
The method
expandAll()
of MatTree expands only the first level of a deeply nested tree. On deprecated MatTreeControl, the same method was able to expand the entire tree without problems.Note: the deprecated control had an advantage that the expansion state could be manipulated before even the view was initialized, but that is another topic.
WORKAROUND:
Reproduction
StackBlitz link:
Steps to reproduce:
ngAfterViewInit
callback.Expected Behavior
MatTree's expandAll() should expand all nodes.
Actual Behavior
Only the first level nodes are expanded.
Environment
The text was updated successfully, but these errors were encountered: