In una struttura ad albero come questoCome aggiungere un figlio a un nodo in un 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
});
Come faccio ad aggiungere un nodo figlio di un nodo (dicono 'nipote')?
Posso accedere al bambino attraversando la radice del treepanel, ma lo ho console.loggato in Firebug, non ha alcuna funzione. Siamo spiacenti per il codice non formattato, non ero in grado di formattarlo.
Per vedere effettivamente la funzione disponibile in Firebug installa Illuminations for Developers - un plug-in Firebug. Estremamente utile per lo sviluppo di ExtJS. – dbrin
ce l'ho :) – Shashwat