在一个树状结构这样如何将子项添加到TreePanel中的节点?
var rootNode = {
id: 'root',
text : 'Root Node',
expanded : true,
children : [
{
id : 'c1',
text : 'Child 1',
leaf : true
},
{
id : 'c2',
text : 'Child 2',
leaf : true
},
{
id : 'c3',
text : 'Child 3',
children : [
{
id : 'gc1',
text : 'Grand Child',
children : [
{
id : 'gc11',
text : 'Grand Child 1',
leaf : true
},
{
id : 'gc12',
text : 'Grand Child 2',
leaf : true
}
]
}
]
}
]
};
var tree = new Ext.tree.TreePanel({
id: 'treePanel',
autoscroll: true,
root: rootNode
});
如何添加任何节点的子节点(说“孙子”)?
我可以通过遍历treepanel的根访问孩子,但我console.logged它在Firebug中,它没有任何功能。 对不格式化的代码抱歉,我无法格式化它。
要实际查看Firebug中的可用功能,请安装Illuminations for Developers - Firebug插件。对ExtJS开发非常有用。 – dbrin 2012-04-24 02:17:42
我确实有:) – Shashwat 2012-04-27 06:04:39