Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Aug 06, 2009 06:16
open dhtmlx forum
how to get the nodeId <<getUserData(nodeId, "type")>>

I generate the first level node by "tree.loadXML("main.do?m=getTreeInitXML");", the result is:

<?xml version="1.0" encoding="UTF-8"?>
<tree id="0">
<item id="namespace" text="namespace" im0="tree_01.gif" im1="tree_01.gif" im2="tree_01.gif" child="1">
<userdata name="type">A<userdata>
</item>
</tree>

and then, I want to use "tree.setXMLAutoLoading("main.do?m=getTreeChildXML&type=" + type);" to get next level nodes. How can I get the type userData content when I click the current node. I know "tree.getUserData(nodeId, "type")" can implement the function, but I don't konw how to get the nodeId.
Answer posted by Alex (support) on Aug 06, 2009 07:12

Hello, 

there is onClink event handler. 

tree.attachEvent("onClick",function(id){

var type = tree.getUserData(id, "type");

})

But if you want to use type userdata in the dynamic loading process, you should set autoloading function (only in PRO edition):

tree.setXMLAutoLoadingBehaviour("function")

tree.setXMLAutoLoading(function(id){

...

})

Answer posted by Monica on Aug 10, 2009 07:47
Hi,

Were u able to fix ur problem? Can u help me on how u did it. I have similar issue for dynamic tree loading for the second level etc. And also in ur struts action 'main.do' how are u returning the XML?

Thanks
Monica