title: Populating a DHTMLx TreeGrid using XML
body: <p>I'm currently in the process of trying to populate a tree grid using XML - the problem is that I'm not sure how to go about doing this. I feel like the DHTMLx docs just aren't clear enough as each example seems to hide the relevant xml.</p>
  
  <p>I have defined my tree grid like so (following an example layout <a href="http://www.dhtmlx.com/docs/products/dhtmlxTreeGrid/samples/01_initialization_loading/02_treeGrid_init.html#code" rel="nofollow">here</a>):</p>
  
  <pre><code>this.treeGrid = new dhtmlXGridObject($scope.divId);
  this.treeGrid.selMultiRows = true;
  this.treeGrid.imgURL = "resources/dhtmlxsuite/dhtmlxgrid/codebase/imgs/icons_greenfolders/";
  this.treeGrid.setImagePath("resources/dhtmlxsuite/dhtmlxgrid/codebase/imgs/");
  this.treeGrid.setHeader("Tree,Plain Text,Long Text,Color,Checkbox");
  this.treeGrid.setInitWidths("150,100,100,100,100");
  this.treeGrid.setColAlign("left,left,left,left,center");
  this.treeGrid.setColTypes("tree,ed,txt,ch,ch");
  this.treeGrid.setColSorting("str,str,str,na,str");
  
  // Init needs to be included or the title won't appear
  this.treeGrid.init();
  
  // Needs the css included in the index.html page before it is enforced
  this.treeGrid.setSkin("dhx_skyblue");
  this.treeGrid.loadXML($scope.xml);
  </code></pre>
  
  <p>So from the above you can see that I want the column called 'Tree' to be the actual tree on this grid. So how should the xml look for this? Do all columns have to have data otherwise it won't populate? I tried the following but it failed with the error <code>Error On Load XML</code>:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='iso-8859-1'?&gt;
  &lt;tree id = "Tree"&gt;
  &lt;item id = "p1" text = "parent item 1"&gt;
      &lt;item id = "c1-0" text = "child item 1" /&gt;
      &lt;item id = "c1-0" text = "child item 2" /&gt;
  &lt;/item&gt;
  &lt;item id="p2" text="parent item 1" /&gt;
  &lt;/tree&gt;
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Note: I'm using DHTMLx pro!</p>