column sort issue for treegrid

I am using the dhtmlXTreeGrid 1.4 professional version and has an issue for the column sorting. here are my code snippet:

    mygrid = new dhtmlXGridObject(‘entityJurBox’);



    mygrid.selMultiRows = true;

    mygrid.imgURL = “/ams/resources/img/dhtmlxTreeGrid/”;

mygrid.setHeader(“Jurisdiction,Filing,Nexus,Nexus Flow,PL 86-272,Rule,Apportionment,Rate”); // header names

mygrid.setInitWidths(“150,100,100,100,100,100,100,100”); // initial header widths

mygrid.setColAlign(“left,left,left,left,left,left,left,left”);

mygrid.setColTypes(“tree,ed,ch,ch,ch,coro,edn,edn”);

mygrid.setColSorting(“str,str,str,str,str,str,str,str”);

mygrid.setNumberFormat(“0.000000%”,6);

mygrid.setNumberFormat(“0.000000%”,7);

mygrid.enableColumnAutoSize(true);



mygrid.attachEvent(“onEditCell”,function(stage, row, col){

if (col==2 || col==4 || col==5)

return true;

return false;

});



mygrid.enableAlterCss(“banded”,"");

mygrid.init();

//mygrid.splitAt(1);

mygrid.loadXML("/ams/entityJurisdictionServlet?entityId=${entity.id}");



As you may be aware, I have a servlet which generates the XML data for tree grid to render. The treegrid displays data as expected. However, when I click the column header 9any header) to sort, I got the javascript error said “Line: 2130 Error: ‘_childIndexes’ is null or not an object”. When I set the alert in the line 2130, dhtmlXGrid.js, I found that row_id=undefined, which cause the above error.



If I create an XML file contains the same data, the column sort is working. So what did I miss?



Here are the data I try to render.

<?xml version="1.0" encoding="UTF-8"?>



    

        New York

        Unitary

        true

        

        false

        



        7.5

        

            New York City

            Unitary

            true



            false





            8.85

        

    



    

        Georgia

        Unitary

        true



        false





        6.0

    

The code which you are provided works fine with static XML, so most probably error somewhere in your servlet which generates XML
Similar problem can occur if you data XML contains empty or not-unique IDs of rows ( in such case grid may render correctly, but any row related action will cause such error )

Please be sure that each row in generated XML contains unique ID , to check data fetched from your servlet you can use attached file instead of default dhtmlxcommon.js♠

dhtmlxcommon_debug.zip (5.82 KB)