dhtmlxTree: adding a URL to an item in the tree

In looking at the samples for dhtmlxTree, I don’t see anything in the XML model that allows the specification of a URL for each item in the tree. We’re thinking of using dhtmlxTree for the navigation for our web site. Is there a simple way to associate a launch URL with each tree item? I didn’t expect that any custom coding would be needed, but now I’m not so sure.

If you want the tree items to be a tags - just use inline HTML

   
<![CDATA[ any test]]>


( The itemtext supported in PRO edition only )

Or you can use userdata sections



    http://some.url/here

and on client side
tree.attachEvent(“onClick”,function(id){
    document.location.href=tree.getUserData(id,“url”);
    return true;
});


Hello,



I have a question on same line…



In the following xml code for grid - how do I disable the onclick functionality for some folders ?



currently If I click on the folder “reporting” - I see error page “page cannot be found” on right side frame




  
   one.html
     
  
   two.html
  



…html snippet



tree.setOnClickHandler(doOnClick);
 function doOnClick(id){
 var Url = tree.getUserData(id,“href”);
 parent.right.location.href = myUrl;



 



Please advise.



Thanks,



skm


There is no way to disable event for some items, it will occur for each, but you can check value of attribute|userdata before executing any action.


function doOnClick(id){
var myUrl = tree.getUserData(id,“href”);
if (myUrl) // can be added
parent.right.location.href = myUrl;


Thanks!



-skm