Categories | Question details Back To List | ||
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. Answer posted by Support on Jun 26, 2008 02:01 If you want the tree items to be a tags - just use inline HTML <tree id="0"> <item id="some"><itemtext><![CDATA[ <a href="http://any.url/here">any test</a>]]></itemtext></item> ( The itemtext supported in PRO edition only ) Or you can use userdata sections <tree id="0"> <item id="some" text="any text"><userdata name="url">http://some.url/here</userdata></item> and on client side tree.attachEvent("onClick",function(id){ document.location.href=tree.getUserData(id,"url"); return true; }); Answer posted on Jun 05, 2009 14:58 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 <item text="Reporting" id="rpt" open="1"> ..html snippet tree.setOnClickHandler(doOnClick);
Please advise. Thanks, skm Answer posted by Support on Jun 08, 2009 01:35 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; Answer posted on Jun 08, 2009 11:53 Thanks! -skm
|