Row Added in Grid


hi,
Adding new row in grid row is added but focus is set on previous row.

function addRow(currGrid,rowIndex,parentIdValue){
  var newId = rowIndex+1;  
  grid.addRow(newId,“text1,text2”,1);

setValue(parentId,xml_doc,newId,mygrid);

//BUtton is added to the Grid for add new Row
    setAddButton(rowIndex, mygrid.getColIndexById(‘markDelete’)+1, mygrid, currGrid.gridName);

grid.selectRowById(newId);

    return;
 
  }

function setAddButton(rowIndex,addColIndex,mygrid,mygridName)
{
        mygrid.cells2(rowIndex,addColIndex).cell.innerHTML=’<INPUT TYPE=“BUTTON” CLASS=“INPUT”  onClick=“javascript:addRow(’+mygridName+’,’+rowIndex+’);” VALUE=“Add” id=“add”’+rowIndex+’ />’;
       
}

Please check if in the command grid.selectRowById(newId newId is a really uniqui id of the row.