this.rowsBuffer[i] has no properties on sort

Hello,



I have just started working with the dhtmlXGridObject object and I am having a sorting issue.



I start out with an empty grid

Then I add a couple of rows using



mygrid.addRow(‘1’,“text1,text2,text3”,1);

mygrid.addRow(‘2’,“text1,text2,text3”,1);



When I try to sort I get the following error this.rowsBuffer[i] has no properties on sort



If I load data first into the grid using mygrid.loadXML(“grid.xml”); and then add rows the sorting works fine. Otherwise it fails.



Here is the entire setup of the grid I’m creating



mygrid = new dhtmlXGridObject(‘gridbox’);

mygrid.setImagePath(“codebase/imgs/”);

mygrid.setHeader(“Column A, Column B, Column C”);

mygrid.setInitWidths(“100,250,100”)

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

mygrid.setColTypes(“ed,ed,ed”);

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

mygrid.init();

mygrid.setSkin(“light”)

mygrid.addRow(‘1’,“text1,text2,text3”,1);

mygrid.addRow(‘2’,“text1,text2,text3”,1);



Craig

The row indexes started from 0, so correct code will be

mygrid.addRow(‘1’,“text1,text2,text3”,0);
mygrid.addRow(‘2’,“text1,text2,text3”,1);

If you adding data in last position - you can skip index parameter at all.