如何解决Ext JS树,在我展开根节点之前,childNodes为空加载完整树结构
| 我第一次加载FULL树形结构。var tree = new Ext.tree.TreePanel({
title : \'Simple Tree\',width : 300,height : 300,root : new Ext.tree.AsyncTreeNode({
children : [
{ text : \'one\',leaf : true },{ text : \'two\',{ text : \'three\',leaf : true }
]
})
});
Ext.onReady(function(){
tree.render(Ext.getBody());
});
然后试试这个
treePanel.root.childNodes // []
但是在我扩展根节点并重试之后
treePanel.root.childNodes // [obj,obj,obj]
是否可以在不扩展根节点的情况下获得childNodes?
解决方法
看来“ 3”仅填充有实际元素。在扩展该节点之前,不需要它们。
您正在寻找的是
treePanel.root.attributes.children
。其中包含三个要素。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。