grid.addRow() issue

Hello,



I have a dhtmlxgrid. I have a button which allows add row to this grid and also a button which allows delete rows from the grid.



Most of the time add row works fine but sometimes it gives following error in FireFox3 console -



this.cell.parentNode is null

getTitle()(" “, undefined)dhtmlxgridcell.js (line 40)

setAttribute()(” “)dhtmlxgridcell.js (line 39)

getValue()()dhtmlxgr…d_math.js (line 8)

getValue()()dhtmlxgr…d_math.js (line 11)

ev()()dhtmlxgrid.js (line 647)

ev()()dhtmlxgrid.js (line 647)

getTitle()(” “, undefined)dhtmlxgridcell.js (line 42)

setAttribute()(” “)dhtmlxgridcell.js (line 39)

_fillRow()(tr, ,)dhtmlxgrid.js (line 749)

_addRow()(2, , 1)dhtmlxgrid.js (line 858)

addRow()(2, “,”, 1)dhtmlxgrid.js (line 866)

addRowBefore()(2, “,”, 1, undefined, undefined, undefined)dhtmlxtreegrid.js (line 41)

onButtonClick(undefined, undefined)myGrid.js (line 919)

setHTML()(click clientX=378, clientY=56, Object id=Insert className=defaultButton)dhtmlxprotobar.js (line 11)

[Break on this error] this.cell.parentNode.idd,



following is the code -



var rowCount = grid.getRowsNum();

grid.addRow(rowCount+1,”,",rowCount);



I get the error on addRow. This errors shows up sometimes not consistently.



Can you please help me. Thanks.

the way how you generate IDs are not safe, if rows added|deleted non unique ID can be generated
You can try to use next code instead

var id = grid.uid();
grid.addRow(id,",",-1);