extjs treepanel:expand()和expandChildNodes()

| 如果我写:
rootNode.expand()
我只能访问此rootNode的子节点,但无法访问此rootNode的孙子节点。我必须写:
rootNode.expandChildNodes()
为了实现它。 即使树倒塌了,还有另一种获取孙子节点或其他子节点的方法吗?除了使用“ 2”功能以外? 我试过了:
rootChildNode.firstChild
但它不起作用。     
已邀请:
ExtJS 4x在树面板组件上具有
expandAll()
方法。这将递归扩展每个节点。     
如果要扩展到特定水平,则在这种情况下:
           expandTo:function(level){

                    treePanel.collapseAll();
                    treePanel.getRootNode().cascadeBy(function (node) {

                          if (node.getDepth() < level) { node.expand(); }
                          if (node.getDepth() == level) { return false; }
                     });
         }
    
到达后代的另一种方法是使用
node.expand(true)
,其中node是根节点。同样,您可以使用树中的任何节点,并使用相同的代码扩展其所有后代节点。常见用法是用于所选节点。     

要回复问题请先登录注册