无法在Extjs treestore中旅行

无法在Extjs treestore中旅行,extjs,Extjs,我有treestore,我想遍历每个节点。我在treestore中没有发现任何功能。但是商店有每个功能。我还尝试了treestore.data。但不是成功。 请帮帮我,谢谢 为什么不能根据您的需求使用Ext.Array.each。。。。 参考下面的示例 Ext.Array.each(records, function(record, index, records) { if(!(record.get('name')==='')){ } }); Ext.data.Tree

我有treestore,我想遍历每个节点。我在treestore中没有发现任何
功能。但是商店有每个功能。我还尝试了treestore.data。但不是成功。

请帮帮我,谢谢

为什么不能根据您的需求使用Ext.Array.each。。。。 参考下面的示例

Ext.Array.each(records, function(record, index, records) {
      if(!(record.get('name')==='')){
      }
});

Ext.data.TreeStore
没有
每个方法,因为它处理
Ext.data.Tree
。但是,如果有
eachChild
方法,则可以使用此方法遍历树

function traverse(node) {
    // do something with node

    node.eachChild(function(child) {
        traverse(child); // handle the child recursively
    });
}

traverse(yourTreeStore.getRootNode()); // start tree traversal with root node

将Ext.each用作下文:

Ext.each(tree.getRootNode().childNodes, function (node) {
        console.log(node.data.text);
    });

为什么需要遍历树节点。。。。你想达到什么目的。。。请指定明确的问题以帮助您…我正在寻找grid.expandAll()的更快实现,所以我尝试grid.getRootNode.eachChild(function(){}),但仍然很慢。。。有没有更快的方法来迭代根节点的子节点?