PDA

View Full Version : How to dynamically assign treeloader to treepanel



sam.arulprakash
16 Jun 2010, 12:13 AM
Hi all,
How to dynamically set this loader in Treepanel.

Is there any method for this one,I have searched in forums and API ,not able to find solution for this.


treepanel.getLoader().dataUrl='...........';//Not Working.
treepanel.getRootNode().reload();

treepanel.loader = new XMLTreeLoader({dataUrl: "http://localhost:60735/WebService.asmx/GetWebserviceOutputxml",requestMethod: 'POST'});
treepanel.getRootNode().reload();//Not Working.


Is there any possibility to change the dataUrl or Treeloader?



Thanks in advance.


XMLTreeLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader,
{
processAttributes : function(attr){
attr.text = attr.name;
if(attr.id){attr.id=attr.id;}
else{attr.id=attr.name; }
if(attr.code){attr.code=attr.code;}
else{attr.code=attr.name;}
attr.cls='folder';
attr.loaded = true;
attr.expanded = true;

}
});
var <%=this.ID %>_XMLTreeLoader=new XMLTreeLoader
({

dataUrl:'http://localhost/controls/ReturnXML',
requestMethod: 'POST'
})

sam.arulprakash
16 Jun 2010, 2:02 AM
I GOT the answer.

just add listener to the treeloader.

declare javascript variable.
set dataUrl Property.

listeners :
{
beforeload:function()
{
if(<%=this.ID %>_URL!='')
this.dataUrl=<%=this.ID %>_URL;
}
}