在一個樹狀結構這樣如何將子項添加到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