gpt4 book ai didi

Angular Material 树展开特定节点

转载 作者:行者123 更新时间:2023-12-03 15:16:01 27 4
gpt4 key购买 nike

我已经看到各种示例来使用扩展 mat-tree 中的所有节点

expandAll()

如果我们点击它,是否有任何机制可以扩展特定节点。就像是
node.expand()

我已经提到了 angular material 文档,但没有得到任何答案。如果有人经历过,请指导。

最佳答案

您要找的是expand方法在 treeControl ,在 treeControl.dataNodes 上运行大批。

就像是

this.treeControl.expand(this.treeControl.dataNodes[/** node you want to expand **/]);

请记住,如果您想扩展一个特定的节点,它的所有祖先直到根节点也需要扩展。

Demo

关于 Angular Material 树展开特定节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55590162/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com