get row id of last row

how do i get the row id of the last row?

var last_id=mygrid.getRowId(mygrid.getRowsNum()-1);

thanks!