DHTMLX Docs & Samples Explorer

Constructor of dhtmlxTree

        var mytree = new dhtmlXTreeObject(parent,width, height, rootId )

where

  • parent - id of HTML element which will be used as parent ( or object itself
  • width - width of tree
  • height - height of tree
  • virtual root ID
      <div id='my_tree_here'></div>
      <script>
      //common init code
      var mytree = new dhtmlXTreeObject("my_tree_here","100%","100%",0);
      </script>

Layout, Window, Accordion, Tabbar can create a tree inside their cells by using

      some_component.cells(some_id).attachTree(rootId)

In this case rootId has same meaning as in native initialization ( it is an optional, 0 used as default value )

Starting from 2.5 version, tree can be initialized by object notation

      var mytree = new dhtmlXTreeObject({
          some_option1:some_value_1,
          some_option2:some_value_2,
          ...
          some_optionN:some_value_N,
      })

List of supported options

	tree = new dhtmlXTreeObject({
		parent:"a_tree",
		image_path:"codebase/imgs/csh_books/",
		onClick:function(){
			alert("I'm clicked");	
		},
		xml:"tree3.xml"
	});