Hi,
Iam using professinal edition. I wanted to get the item text along with the item id in the server side(struts framework) whenever i click any node…
As of now… iam having a node with id “M1” and with item text “Model1”…
Iam using ajax call to load the url’s dynamically as,
String1 = “JobAction.do?param=loadTree”;
String2 = “JobAction.do?param=loadDoc”;
String3 = “JobAction.do?param=loadDate”;
tree1.loadXML(String1);
tree1.setXMLAutoLoadingBehaviour(“function”);
tree1.setXMLAutoLoading(function(id){
var level = tree1.getLevel(id);
alert(level);
alert(“ID*****”+encodeURIComponent(id));
alert(“TEXT****”+encodeURIComponent(tree1.getItemText(id)));
var url="";
if (level == 2) url=String2;
if (level == 3) url=String3;
tree1.loadXML(“url&id=”+encodeURIComponent(id)+“text=”+encodeURIComponent(tree1.getItemText(id)));
});
Initially String1 XML is formed and the tree is loading,
but when i click the + sign to load next set of url’s,i get
level as 0
id as 0 and
text as 0…
When i changed the if condition as
if (level == 0) url=String2; Then i get
level as 0
id as 0,
text as 0 in the alert message of ajax js method
but i get some junk value associated with the id as, “%29M1%20” and text still as 0 in the server side code.
Please help like how to get the correct value of the ID and ItemText of which i click and want to load dynamically.
The last line in your code is incorrect ( probably a typo?)
tree1.loadXML(“url&id=”+encodeURIComp
must be
tree1.loadXML(url+"&id="+encodeURIComp
>>text as 0…
This is impossible situation, getItemText will return empty string in worst case, but it can’t return an 0 valueon its own.
The same code generates expected URL in case of local sample
If issue still occurs please provide an XML snippet for which error occurs