DataGrid.deleteRows

Syntax

deleteRows(globalRowIndexes: Number | Array, end: Number);

Parameters

globalRowIndex. Array of indexes of deleted rows or index of the first deleted row.

end. Index of the last deleted row.

Description

The deleteRows method deletes rows from the table.

Example

To execute the example, the HTML page must contain the DataGrid component named grid (see Example of Creating the DataGrid Component). Add handlers for delete row events and delete the first two rows:

// Set asynchronous data loading to source
grid.getDataSource().setIsAsync(True);
// Add handlers for table row delete events
grid.RowsDeleted.add(function(sender, args) {
    console.log("Table rows are deleted");
});
grid.DeletingRows.add(function(sender, args) {
    console.log("Table rows are being deleted");
    if (grid.getDataSource().getIsAsync()) {
        grid.getDataSource().setIsAsync(False);
        grid.deleteRows(args.Rows);
        grid.RowsDeleted.fire(grid, {
            Rows: args.Rows
        });
    }
});
// Delete the first and the second table rows
grid.deleteRows([0, 1]);

As a result the firs two rows are deleted from the table:

The console displays messages about roe delete events:

Table rows are being deleted

Table rows are deleted

See also:

DataGrid