PDA

View Full Version : TreeLoader - Need New Event? Or how to load tree without Loader



extAsplode
6 Aug 2010, 12:31 PM
I have a TreePanel that I'm loading with a TreeLoader as in the following code. The Json that's returned from the dataUrl doesn't contain Ext-based attributes like 'text' or 'children', etc. How can I manipulate the Json data after the call to the dataUrl but prior to the TreePanel consuming the Json?

Looks like the only events available are beforeload which is too early and load which is too late. Is there perhaps a way to load a TreePanel from a straight javascript config object without going through TreeLoader?

The loader code:


loader: new Ext.tree.TreeLoader({
dataUrl: '/foo/someServiceEndpoint'),
preloadChildren: true,
baseAttrs: passedConfig.baseAttrs || {},
baseParams: {
param1: 1
},
listeners: {
'load': function(loader, node, response){
var bar = 0;
}
}
}),


Thanks,
Andy

extAsplode
6 Aug 2010, 12:51 PM
Sorry, I just discovered a post about loading a TreePanel from static json which will solve my problem. http://www.sencha.com/forum/showthread.php?4595-Creating-Ext.tree.TreePanel-from-static-JSON-data-in-one-shot

Thanks,
Andy