TreeGrid: Select row on initial load

We are attempting to “pre-select” a row when we initiate a treegrid object. We have tried to use the “onXLE” event to do so:



    mygrid.attachEvent(“onXLE”,function() {

        mygrid.selectRowById(myRowID);

    });



As well as part of the “loadXML” call:



    mygrid.loadXML(“data.xml”,function() {

        mygrid.selectRowById(myRowID);

    });



Both are resulting in an “Object doesn’t support this property or method” error being thrown.

We are currently using a v1.5 evaluation copy (upgrading to v1.6 shortly.)



Thanks!

There was no such method as selectRowById in dhtmlxgrid 1.5 ( it was introduced in dhtmlxgrid 1.6 )
You may use

mygrid.loadXML(“data.xml”,function() {

        mygrid.setSelectedRow(myRowID);

});


 
( the setSelectedRow has the same effect as selectRowById in dhtmlxgrid 1.5, in dhtmlxgrid 1.6 it can be used as alias for selectRowById )


Thanks. We had found a solution using:



mygrid.selectRow(mygrid.getRowById(myRowID));



But the provided solution is much easier to read.