Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Chris Case on Aug 14, 2008 14:50
open dhtmlx forum
DHTMLxTreeGrid: Problem Dynamically Loading XML

Hello,

I am using your DHTMLxTreeGrid to load some data and I have run into a bug. When I hit the + on the second level of "xmlkids" I get a weird behavior.

Lets say, for example, that I have two items on the level described above and I click one of them, everything works fine. But when I open the second one it starts acting buggy.

I have seen it duplicate the first element of the, previously opened, element. It also tends to dis-associate the elements from the tree, to where I cannot hit the "-" and minimize it down.

Here is the XML i use in the original tree:

<?xml version="1.0" encoding="UTF-8"?>
<rows parent="0">
<row id="1111" open="1">
<cell>U.S. Army</cell><cell/><cell/>
<row image="" id="2" open="1">
<cell>2nd Infantry</cell><cell/><cell/>
<row image="" id="3.2" expand="1" open="1">
<cell>1st Heavy Brigade Combat Team</cell>
<row image="" id="3.3.2" expand="1" open="1">
<cell>1st Battalion 72nd Armor</cell>
<row image="" id="C_1" xmlkids="">
<cell>Alpha</cell>
</row>
</row>
<row image="" id="3.3.4" expand="1" open="1">
<cell>MyTestBattalion</cell>
</row>
<row image="" id="3.3.6" expand="1" open="1">
<cell>None</cell>
<row image="" id="C_5" xmlkids="">
<cell>None</cell>
</row>
</row>
</row>
<row image="" id="3.4" expand="1" open="1">
<cell>RAMBO Brigade</cell>
</row>
</row>
<row image="" id="4" open="1">
<cell>Fielding and Training Division</cell><cell/><cell/>
<row image="" id="5.6" expand="1" open="1">
<cell>16 Cavalry Regiment</cell>
<row image="" id="5.7.8" expand="1" open="1">
<cell>Light Track Battalion</cell>
<row image="" id="C_4" xmlkids="">
<cell>None</cell>
</row>
</row>
</row>
<row image="" id="5.8" expand="1" open="1">
<cell>1st Armor Training Brigade</cell>
<row image="" id="5.9.10" expand="1" open="1">
<cell>A Fleet</cell>
<row image="" id="C_3" xmlkids="">
<cell>None</cell>
</row>
</row>
</row>
</row>
<row image="" id="6" open="1">
<cell>SIL Division</cell><cell/><cell/>
<row image="" id="7.10" expand="1" open="1">
<cell>SIL Brigade</cell>
<row image="" id="7.11.12" expand="1" open="1">
<cell>SIL Battalion</cell>
<row image="" id="C_2" xmlkids="1">
<cell>SIL Company</cell>
</row>
<row image="" id="C_9" xmlkids="1">
<cell>SIL Test Company</cell>
</row>
</row>
</row>
</row>
</row>
</rows>

Then here is XML that is dynamically loaded when the lowest-level nodes are clicked:

<?xml version="1.0" encoding="UTF-8"?>
<rows parent="C_9">
<row id="V_1" xmlkids="1"><cell>Vehicle: LA22023U</cell><cell>19</cell></row>
<row id="V_2" xmlkids="1"><cell>Vehicle: SILLA22023U</cell><cell>3</cell></row>
</rows>


Once those nodes are clicked the following is an example of the XML that will load when I click the last one "V_1":

<?xml version="1.0" encoding="UTF-8"?>
<rows parent="V_1">
    <row><cell>Run #28</cell><cell/><cell>2007-10-04 11:10:50.0</cell><cell>4 minutes </cell><cell>27</cell></row>
    <row><cell>Run #27</cell><cell/><cell>2007-10-04 09:45:04.0</cell><cell>79 minutes </cell><cell>27</cell></row>
    <row><cell>Run #26</cell><cell/><cell>2007-10-03 17:14:33.0</cell><cell>0 minutes </cell><cell>27</cell></row>

    <row><cell>Run #25</cell><cell/><cell>2007-10-03 17:09:24.0</cell><cell>3 minutes </cell><cell>27</cell></row>
    <row><cell>Run #24</cell><cell/><cell>2007-10-03 16:17:55.0</cell><cell>50 minutes </cell><cell>27</cell></row>
    <row><cell>Run #23</cell><cell/><cell>2007-10-03 16:14:13.0</cell><cell>2 minutes </cell><cell>27</cell></row>

    <row><cell>Run #22</cell><cell/><cell>2007-10-03 16:08:13.0</cell><cell>4 minutes </cell><cell>27</cell></row>
    <row><cell>Run #21</cell><cell/><cell>2007-10-03 15:57:08.0</cell><cell>9 minutes </cell><cell>27</cell></row>
    <row><cell>Run #20</cell><cell/><cell>2007-10-03 15:49:30.0</cell><cell>6 minutes </cell><cell>27</cell></row>

    <row><cell>Run #19</cell><cell/><cell>2007-10-03 15:47:44.0</cell><cell>0 minutes </cell><cell>27</cell></row>
    <row><cell>Run #18</cell><cell/><cell>2007-10-03 15:43:32.0</cell><cell>2 minutes </cell><cell>27</cell></row>
    <row><cell>Run #16</cell><cell/><cell>2007-10-03 15:30:33.0</cell><cell>4 minutes </cell><cell>27</cell></row>

    <row><cell>Run #15</cell><cell/><cell>2007-10-03 15:27:57.0</cell><cell>1 minutes </cell><cell>27</cell></row>
    <row><cell>Run #14</cell><cell/><cell>2007-10-03 15:24:50.0</cell><cell>2 minutes </cell><cell>27</cell></row>
    <row><cell>Run #12</cell><cell/><cell>2007-10-03 13:36:44.0</cell><cell>0 minutes </cell><cell>27</cell></row>

    <row><cell>Run #11</cell><cell/><cell>2007-10-03 13:14:07.0</cell><cell>13 minutes </cell><cell>27</cell></row>
    <row><cell>Run #10</cell><cell/><cell>2007-10-03 13:03:06.0</cell><cell>10 minutes </cell><cell>27</cell></row>
    <row><cell>Run #9</cell><cell/><cell>2007-10-03 12:38:28.0</cell><cell>22 minutes </cell><cell>27</cell></row>

    <row><cell>Run #8</cell><cell/><cell>2007-10-03 12:32:50.0</cell><cell>4 minutes </cell><cell>27</cell></row>
</rows>


Then after I click V_1, the trouble begins, and the following XML is loaded:

<?xml version="1.0" encoding="UTF-8"?>
<rows parent="V_2">
    <row><cell>Run #30</cell><cell/><cell>2007-10-04 16:24:32.0</cell><cell>24 minutes </cell><cell>27</cell></row>
    <row><cell>Run #29</cell><cell/><cell>2007-10-04 11:16:24.0</cell><cell>12 minutes </cell><cell>27</cell></row>
    <row><cell>Run #165</cell><cell/><cell>2007-09-13 08:13:20.0</cell><cell>76 minutes </cell><cell>27</cell></row>

</rows>


After this, I end up having to re-load the tree, to get things back to their original state. Any help is greatly appreciated.
Answer posted by Support on Aug 15, 2008 03:48
Each row must have unidue ID
In your case

<?xml version="1.0" encoding="UTF-8"?> 
<rows parent="V_1"> 
  <row><cell>Run #28</cell><c

Some rows has not ID at all , this is cause an issue