Custom Code:Adding new row then refreshing from server to ge

Hi. I am upgrading from 1.4 to 1.6. I have code to add a new row, send update to server to get a new id, change rowId of the new row from the update and do an updatefromxml to get data necessary for a new row. This is now broken.

CODE Below…

function addNewRow() {


    var newId = “New:” + Date.parse(new Date());


    mygrid.setUserData(newId,“new”,“1”);//mark row as NEW    

    mygrid.cells(newId,1).setValue( orderId);    


    lastrow = mygrid.rowsCol.length - 1;    


    mygrid.selectRow(lastrow, false, false);



//send server request for upating/creating row

function sendServerUpdateRequest(rId){


    var rowValuesAr = getCellsArray(rId);    


        var action = “add”;


    var url = actionURL+"?do="+(!action?“update”:action)+"&id="+rId+"&values="+rowValuesAr.join("|");

    rowUpdater.loadXML(url+"&un="+Date.parse(new Date()));    


cellUpdater = new dtmlXMLLoaderObject(doUpdateCell,window, false);

function doUpdateCell() {    

    var root = cellUpdater.getXMLTopNode(“status”);

    var oldId = root.getAttribute(“oldid”)

    var rowId = root.getAttribute(“rowid”)


    mygrid.setRowId(mygrid.getRowIndex(oldId), rowId)//set new row id (if it was chnaged for new row)



    mygrid.setUserData(rowId, “changed”, “0”)

    mygrid.setUserData(rowId, “new”, “0”)        

    mygrid.updateFromXMLSync(loadDataURL + “&rowId=” + rowId);        



!!!Below is broken, I am getting r has no properties…How can I get to the new row that was added.

mygrid.setRowId(mygrid.getRowIndex(oldId), rowId)//set new row id (if it was chnaged for new row)


Peter Ang


    lastrow = mygrid.rowsCol.length - 1;   
This code may return incorrect result, the grid has native method
    lastrow = mygrid.getRowsNum()-1;
it will return correct result in any mode ( including paging and SRND )

Please try to replace
    mygrid.setRowId(mygrid.getRowIndex(oldId), rowId)

The setRowId may work incorrectly in case of SRND|paging mode - the issues already fixed in inner build, and will be released as part of oncoming update