:: Documentation >>

deleteRow

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.

null

Syntax

obj.deleteRow(index);

Parameters

index (string/number) - row index

Examples

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);
}

Remarks

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.

See also

addRow method, row indices property, row events

Comments

Set cell tool tip User1 (1)
how to delete a first row rafi (1)
Bug in example? Rob L (1)
Issue with deleteRow Mark Elrod (0)
Adding/Deleting Rows (1)
how to delete row from sorted grid Adam Zielinski (4)

Documentation:

Recent changes:

2.6.4
2.6.3
2.6.2
2.6.1
2.6.1
2.6.0
2.5.0 - 2.5.6
2.5.6
2.5.0 - 2.5.5
2.5.5