Deletes the row from the grid.
deleteRow()
method does not delete the row from the datasource, it removes the row index from the row indices array and updates the display without full grid refresh.
This method triggers onRowDeleting and onRowDeleted events.
nullobj.deleteRow(index);
index (string/number) - row index
var myData = [
["row 0", 0],
["row 1", 1],
["row 2", 2],
]
var obj = new AW.UI.Grid;
obj.setCellData(myData);
obj.setColumnCount(2);
obj.setRowCount(3);
document.write(obj);
function deleteRow(){
// get the last row index
var i = obj.getRowCount() - 1;
// update grid
obj.deleteRow(i);
}
When using deleteRow() do not delete the row from the datasource. You should somehow mark the row as deleted, but you should not physically remove the row from the data array or XML object. This is important because removing the row changes (shifts) the indices of the remaining rows and it would break the display. You can restore the display with a full grid refresh but using deleteRow()
method allows to avoid full refresh if the row indices stay the same.