PDA

View Full Version : dataUrl not working with TreeLoader



topcoder1
21 Aug 2007, 12:32 AM
I have been struggling for a while with getting dataUrl config to work with TreeLoader, it simply refuses to send the request to the server. the dataUrl I have is valid. if I paste the url into my browser I get a valid json response back. I tried both full path and relative path for the url... no request is being send from my end...




rightNavPanel=new Ext.ContentPanel('east-div', {fitToFrame:true});
mainLayout.add('east',rightNavPanel);



var treePanel=new Ext.tree.TreePanel(rightNavPanel.el,{

animate:true,
enableDD:true,
containerScroll: true,
lines:false,
rootVisible:true

});
// set the root node
this.root = new Ext.tree.AsyncTreeNode({
text: 'Tags',
draggable:false
,treeLoader:new Ext.tree.TreeLoader({
dataUrl: 'data.php'

})
});
treePanel.setRootNode(this.root);

treePanel.render();
this.root.expand();

justCharlie
7 Apr 2008, 2:23 PM
i don't think there's a treeLoader property for the AsyncTreeNode, you have to use the loader property for the TreePanel, and set an id (i believe the root directory) in the AsyncTreeNode



TreePanel({...
loader: new Ext.tree.TreeLoader({dataUrl: 'data.php'})
..});

AsyncTreeNode({
...
id: '/rootdir'
...
});