Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Aug 04, 2008 23:38
open dhtmlx forum
Get Node Value

Hi,

Iam Using setXMLAutoLoading method to load Items dynamically..In this case the id gets passed to the server side correctly.
Is there any way for me to me get the ItemText(i.e. the Node Value) Of the clicked Item???

Can i use itemtext = tree1.getItemText(id); function??

If So please tell me how to use that,as of now iam not attaching any event like,
setOnClickHandler and setOnOpenHandler as it affects the dynamic loading part...
I want both id as well as item's text Whenever i open a node with dynamic loading functionality..

Thanks in advance.
Answer posted by Support on Aug 05, 2008 01:52

>>Can i use itemtext = tree1.getItemText(id); function??
This code can be used on client side to get text by ID ( of course, it can be used against already loaded items only )

>>setOnClickHandler and setOnOpenHandler as it affects the dynamic loading part...
If custom code attached to event returns true, it will not affect existing functionality in any way. 

If you need to get item text on server side you can use next code

tree.setXMLAutoLoadingBehaviour("function");
tree.setXMLAutoLoading(function(id){
      tree.loadXML("some.php?id="+encodeURIComponent(id)+"text="+encodeURIComponent(tree.getItemText(id)));
})

Answer posted on Aug 05, 2008 07:08

Is XMLAutoLoadingBehaviour() is in professional edition????

As of now iam not using XMLAutoLoadingBehaviour() ,iam just using XMLAutoLoading() function and loading the nodes based on the 'id' got from the server side..

Is there any other way to pass itemtext in this case??

Answer posted by Support on Aug 05, 2008 08:13
>>Is XMLAutoLoadingBehaviour() is in professional edition????
yes

>>Is there any other way to pass itemtext in this case??
only code modification
dhtmlxtree.js , line 4154

this.loadXML(src+getUrlSymbol(src)+"uid="+sn+"&id="+this._escape(id));

you can modify url line in any necessary way