Categories | Question details Back To List | ||
how to add links in XML (dhtmlTree) Hi, I need to add a link to this child node <item text="name" id="123" > please help me how to add the a href link to above given line. i need to do ant thanges in JS file to add this link or just need to add the link directly in XML file? Answer posted by Support on Feb 12, 2008 01:39 The dhtmlxtree has not built in ability for inline links buy you can next one of two solutions a) define all in xml <item id="123" > <itemtext><![CDATA[ <a href="link">Name</a> ]]></itemtext> </item> b) mixed <item text="name" id="123" > <userdata name="some_name">some_value</userdata> </item> .... tree.attachEvent("onClick",function(id){ document.location.href=tree.getUserData(id,"some_name"); }); Answer posted by Steve on May 24, 2008 22:06 Does the first method only work in the Pro version? I get 'undefined' in the output of my tree if I try it in the standard version. If that is the case, does the Pro version support having multiple html links on a single tree line? I'm using the tree to collapse text with URL links and I'd like the children (and parents for that matter) to allow multiple clickable links. Something like this: * <Parent link 1> <Parent link 2> ** <child link 1> <Child link 2> Thanks for any information. Steve Answer posted by Steve on May 24, 2008 22:40 Nevermind... I figured out how to do it using the standard version. I just had to use escaped HTML in the text like this: "<a href=/path/details?period_type=weekly&start_date=2008-01-01>Name</a> <a href=/path/prog2?period_type=weekly&start_date=2007-01-01>SecondName</a> " Thanks for your great tree! :-) Steve Answer posted by Steve on May 24, 2008 22:41 I should mention that I didn't use the <itemtext> but rather just used the standard <item text="my-escaped-html-data-here" id="1" child="1"> Answer posted by Support on May 26, 2008 04:23 >>Does the first method only work in the Pro version? itemtext sub tag supported only in pro version, but you can use escaped data of attribute in standard version for the same purpose >>support having multiple html links on a single tree line You can use any HTML as item value ( so you can have multiple links there ) While you can have multiple userdata sections as well - it can' t be used for such scenario ( onclick event has not info, which part of item text was clicked ) |