Click item on tree and display iframe

Dear Support Team,



How to open another websitepage (www.bing.com | | |

| ----------------------------------------------------

| search

----------------------------------------------------------------------------------------------------





Thank you for your help, it will be usefull with simple sample



BR,

Bern

Dear Bernard,

here is a small sample:

dhxLayout = new dhtmlXLayoutObject(“parentId”, “2U”);
dhxTree = dhxLayout.cells(“a”).attachTree();
dhxTree.setImagePath(“codebase/imgs/”);
dhxTree.insertNewChild(0,1,“google”);
dhxTree.setUserData(1,“url”,“http://google.com”);
dhxTree.attachEvent(“onClick”,function(id){
    dhxLayout.cells(“b”).attachURL(dhxTree.getUserData(id,“url”));
})

If you load tree structure from xml, the userdata can be set by userdata tag:

http://google.com


Dear Alex,



i have succed when open iframe without xml tree, but when using xml tree, i always failed, here is my code



tree.xml :



  <item   text=“Web” id=“so” im0=“tombs.gif” im1=“tombs_open.gif” im2=“tombs.gif” >
  
   <item text=“google” id=“g” im0=“books_close.gif” im1=“books_open.gif” im2=“books_close.gif” url=“google.com”/>
    



and here is part of my index.html



var dhxTreeAccord = dhxAccords.cells(“aa1”).attachTree();
 dhxTreeAccord.setImagePath("./dhtmlxTree/codebase/imgs/csh_bluefolders/");
 dhxTreeAccord.loadXML("./dhtmlxTree/samples/common/tree.xml?etc=" + new Date().getTime());
 dhxTreeAccord.attachEvent(“onClick”,function(id)
 {
    dhxAccord.cells(“b1”).attachURL(dhxTreeAccord.getUserData(id,“url”));
 }
 )



 



BR,



Bernard

You have set the userdata incorrectly. Please, see our previous answer - the correct way is:

http://google.com





Dear Alex,



Thanks you for your correction and all your help :slight_smile:



Regard,



Bernard