Tree with link on nodes

Hi, i want to have a tree but with links in the last level, i was checking this link
dhtmlx.com/docs/products/dhtmlxT … .html#code

but with no much success, here is my code

and my XML looks like one example in doc samples:

[code]<?xml version="1.0"?>





<![CDATA[HTML]]>









[/code]

any ideas? i only want to have a link in the last level(s) of my tree

thanks in advance for your response

Euler Sánchez

Hello,

tag is available only in PRO edition and it would be more correct to define the whole link (inlcuding http://)

<![CDATA[HTML]]>

In case of Standard edition you may try to use userdata and “onClick” event. The item style (text color and underline text-decoration) can be set by “style” attribute:

http://www.google.com

Hi Alexandra!

I’m using Json and I’m trying to create a link on every node that isn’t a folder. Since I read that the itemtext-tag is only available in Pro-edition, I’m wondering if you can show me an example of linknodes in Json using something similar to http://www.google.com?

thanks

//David

Hi,

you may define the userdata as follows:

{id:1,text:“some text”,userdata:[{name:“href”, content:“http://www.google.com/”}]}

Hi thanks for answering

I added this code in my Json but nothing happens when pushing the link. Is there something else in addition to “userdata”, that need to be added to make it continue to the URL specified in “content”?

Thanks!
//David

You should define onClick event handler that will process the userdata you’ve set:

tree.attachEvent(“onClick”,function(id){
window.open(tree.getUserData(id,“href”));
})

Hello everybody.

this code works fine but the window.open open automatically a window (like pop up) when my page is loading. What can I do to fix it ? I got IE6&8. IE 8 block the window but not IE6.

thanks for help :slight_smile:

I resolve the problem :
tree.attachEvent(“onClick”,function(id){
if (tree.getUserData(id,“href”)!= undefined)
{
window.open(tree.getUserData(id,“href”));
}
return true;
});

And it fix too the problem with " Folders to not have the onClick Event "

What can I do to fix it ?

Make sure that there are not items those are selected by default. Possibly xml contains call=“1” attribute for some item.

Hi,

I don’t use json, can you give me an example for a non-pro user of linknodes in Json using something similar to http://www.google.com?

Best regards
nor

In case of Standard edition you may try to use userdata and “onClick” event. The item style (text color and underline text-decoration) can be set by “style” attribute:

http://www.google.com

You should define onClick event handler that will process the userdata you’ve set:

tree.attachEvent(“onClick”,function(id){
window.open(tree.getUserData(id,“href”));
})

Hi, thanks for your fast reply.

It works, but when I click on link it opens in a new window, how can I get it on same window?

Best regards

This issue isn’t related dhtmlxTree component. But usually if you want open another url in current window you should modify window.href properly. For more information please refer JavaScript documentation

Hi,

I’m using connector and I’m trying to create a link on every node that isn’t a folder. I know the itemtext-tag is only available in Pro-edition, and I think that I can achieve it if and onclick attachEvent can be used.
I have found the set_userdata function with TreeDataItem class in tree_connector.php, but I am not sure how to use it. Could you let me know the procedure?

Thanks,
Ryoichi

Hi,

I have discovered following forum, and self-solved for may question.

http://forum.dhtmlx.com/viewtopic.php?f=3&t=16847&start=0&hilit=userdata

Thanks,
Ryoichi