dhtmlxTree data loading and event handling

I’m using a dhtmlxLayout and attaching a dhtmlxTree to one of its cells. The following are my questions:

1. Is it possible to do:

tree = dhxLayout.cells(“a”).attachTree(0);

then load “tree” contents from inline HTML? If yes, how? In the documentation, I could only see functions to load from XML, JS Array and objects other than HTML.

2. My Layout has two cells. The tree will be displayed in cell ‘a’, then I’d like a report to be displayed in cell ‘b’ once the user clicks on a tree item. I can use layout.attachURL(url) to attach the report URL to cell ‘b’, but it’s a different URL for each report. How can I do that? In the documentation, I could see only one event handler function for the whole tree, not by item.

Thank you.

In case of using attachTree method tree content can’t be loaded from inline HTML. But in common case tree tree can be initialized from html:

dhtmlxTree/samples/initialization_general_settings/tree_init_from_html.html ( dhtmlx.com/docs/products/dhtmlxT … _html.html )

You can load the page with tree using attachURL method into the layout cell. But this case you should take into consideration that tree will be inside iframe in this case.

Regarding onClick event for the whole tree… The event gets item id as a parameter. So, you can execute some code for a certain node:


/your code here/