5

私が書いた場合:

rootNode.expand()

このrootNodeの子ノードにしかアクセスできませんが、このrootNodeの孫ノードにはアクセスできません。私は書かなければなりません:

rootNode.expandChildNodes()

それを達成するために。

ツリーが折りたたまれている場合でも、孫または子ノードを取得する別の方法はありますか?関数を使用する以外にnode.eachChild()?私は試した:

rootChildNode.firstChild

しかし、それは機能しません。

4

3 に答える 3

2

ExtJS 4xexpandAll()には Tree Panel コンポーネントのメソッドがあります。これにより、すべてのノードが再帰的に展開されます。

于 2012-10-25T00:18:44.993 に答える
1

特定のレベルに拡張したい場合は、その場合:

           expandTo:function(level){

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

                          if (node.getDepth() < level) { node.expand(); }
                          if (node.getDepth() == level) { return false; }
                     });
         }
于 2013-03-12T09:53:54.480 に答える
0

Another way to get to the descendants is to use node.expand(true), where node is the root node. Similarly, you can take any node within the tree and expand all of its descendant nodes using this same code. A common usage is for the selected node.

于 2013-08-22T12:50:46.297 に答える