Grid.addRow() Throws 'this.obj.firstChild' is null error

I’m trying to add a row to my grid using bellow code.

var newRow = grid.addRow(newRowId, ["", "", "", "", "", "", "", "", "", ""], -1);

And it throws this error " ‘this.obj.firstChild’ is null or not an object"

Here is the xml generated by the java code to construct the grid.

<rows>
<row id="1324">
 <cell>KAL</cell>
 <cell>Korean Air</cell>
 <cell/>
 <cell>1</cell>
 <cell>1</cell>
 <cell>1</cell>
 <cell>1</cell>
 <cell>1</cell>
 <cell>1</cell>
 <cell>1</cell>
 </row>
<row id="1325">
 <cell>MFL</cell>
 <cell>Master Fault List</cell>
 <cell/>
 <cell>1</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 </row>
<row id="1326">
 <cell>MFT</cell>
 <cell>Master Fault Table</cell>
 <cell/>
 <cell>1</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 <cell>0</cell>
 </row>
 </rows>

This is a smart rendering enabled grid and here’s the code that I use for that.

    grid.enableSmartRendering(true);
    grid.enablePreRendering(40);

Can someone help me to fix this issue please. Is my xml format is incorrect or this is due to any other issue?

Thanks,
Nuwan

index of a row is a zero-based parameter. the value cannot be “-1”.