TreePanel add children problem
Hi All,
i have this
Code:
var tree = new Ext.tree.TreePanel({
id:'treeTypeGraph',
loader:new Ext.tree.TreeLoader(),
width:200,
height:400,
renderTo:Ext.getBody(),
root:new Ext.tree.AsyncTreeNode({
id:'root',
expanded:true,
leaf:false,
text:'Tree Root',
children:[]
})
listeners: {
render : function( _this) {
load();
}
});
function load(){
var arrChildrenTreeMP= new Array();
var aNode= new Ext.data.Node();
aNode.id= "cMP_1a";
aNode.text= "1 a";
var attr= new Array();
attr["code"]="code_n1a";
attr["desc"]="NODE 1 a";
aNode.attributes= attr;
aNode.leaf= true;
arrChildrenTreeMP[arrChildrenTreeMP.length]= aNode;
var aNodea= new Ext.data.Node();
aNodea.id= "cMP_1b";
aNodea.text= "1 b";
var attra= new Array();
attra["code"]="code_n1b";
attra["desc"]="NODE 1 b";
aNodea.attributes= attra;
aNodea.leaf= true;
arrChildrenTreeMP[arrChildrenTreeMP.length]= aNodea;
var root= Ext.getCmp('treeTypeGraph').getRootNode();
root.appendChild(arrChildrenTreeMP);
Ext.getCmp('treeTypeGraph').doLayout();
}
but the array does'nt load...what is wrong?