PDA

View Full Version : tree preloadChildren getNodeById problem



emredagli
15 Mar 2011, 7:17 AM
Hii,
I have a treepanel.
I want to load all tree items once at a time and initially want to show only first level of tree data.

I used preloadChildren:true config but I could not get a node (under 2. level) by using getNodeById method of treepanel after tree is loadded.



var configObj = {
layout: 'anchor',
xtype: 'panel',
style: 'padding:5px;',
items: [{
height: 400,
width: 400,
xtype: 'treepanel',
id: 'categoryTree_',
rootVisible: false,
root: {
id: 'rootcategory',
expanded:false
},
loader: new Ext.tree.TreeLoader({
preloadChildren: true,
url: 'DummyStoreData.asmx/GetTreeData',
baseAttrs: { expanded:false},
listeners: {
load: function(cmp, node, response) {
if (window.console) {console.log("loadded");} else {alert("loadded");}
//afterLoadCategoryTree(node, response);
}
}
}),
listeners: {
checkchange: {
fn: function(node, checked) {
return;
},
scope: this
},
afterrender: function(cmp) {
categoryTree_ = cmp;
categoryTree_.getRootNode().expand();
//categoryTree_.loader.load(categoryTree_.getRootNode());
//if (window.console) {console.log("load tree");}
}
}
}]
};
var mainLayout = new Ext.Viewport(configObj);


I check the Web service, all data is sended to client.

Thanks for your help.