DHTMLX Docs & Samples Explorer

Initialization from xml

You can place this JavaScript tree menu anywhere on your web page, attaching the tree to any object.
Set up tree parameters to determine the appearance of the tree. Specify whether the tree items will be loaded dynamically from XML. dhtmlxTree uses AJAX for fast and flexible data loading.

 
Parameters passed to the constructor are:
  • object to attach tree to (should be loaded before calling constructor)
  • width of the tree
  • height of the tree
  • identifier of the tree root level (super root)

  • Specify Additional parameters of the tree:
  • setImagePath(url) - specifies the path to the folder with tree icons
  • loadXML("../common/tree.xml") - loads tree items from XML
  • Source
    <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
    <script  src="../../codebase/dhtmlxcommon.js"></script>
    <script  src="../../codebase/dhtmlxtree.js"></script>
     
     
    <table>
        <tr>
            <td>
                <div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"/>
            </td>
            <td rowspan="2" style="padding-left:25" valign="top">
        
            </td>
        </tr>
        <tr>
            <td>&nbsp;</td>
        </tr>
    </table>
     
        Parameters passed to the constructor are:
            <li>object to attach tree to (should be loaded before calling constructor)</li>
            <li>width of the tree</li>
            <li>height of the tree</li>
            <li>identifier of the tree root level (super root)</li><br>
        Specify Additional parameters of the tree:
            <li>setImagePath(url) - specifies the path to the folder with tree icons</li>
            <li>loadXML("../common/tree.xml") - loads tree items from XML</li>
    <script>
    tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "100%", 0);
    tree.setSkin('dhx_skyblue');
    tree.setImagePath("../../codebase/imgs/csh_bluebooks/");
    tree.loadXML("../common/tree3.xml");
    </script>