SMART datagrid v.1 > Classes > GridDataSet

Back  Forward

DataLudi.GridDataSet.deleteRows  method

Delete the rows corresponding to data row index list which is transferred by rows. Actually, if delete one or more rows, the event will be fired according to rowEvents setting. 

If rowEvents is trueonRowDeleted,onRowCountChanged events will be fired whenever deleting individual rows, and if do not specify or specify as falseonRowsDeleted and onRowCountChanged events will be fired in order after deleting all rows. 

function deleteRows (rows: [Integer], rowEvents: Boolean);
Returns
Void
Parameters
rows - [Integer]. required.
The array of row indexes which will be deleted. If it is null or the number of array is less than 1, it will not be run.
rowEvents - Boolean. Defaults to false.
If it is true, confirmation and completion events will be fired in row units. If it is DataSet.undoable, events in row unit will not be fired regardless of this property.
Code -1
    // Deleting event handler
    ds.onRowsDeleted = function (ds, rows) {
        console.log(rows.length + 'The rows have been deleted.';
    }
    ds.onRowCountChanged = function (ds) {
    }   $('#txtCount').val(ds.rowCount());
    
    // Delete the checked data rows.
    var rows = [];
    for (var i = 0, cnt = grid.rowCount(); i < cnt; i++) {
        var row = grid.getRow(i);
        row.isChecked() && row.dataIndex() >= 0 && rows.push(row.dataIndex());
    }
    if (rows.length > 0) {
        ds.deleteRows(rows, false);
    }
See Also
deleteRow
onRowCountChanged
onRowsDeleted
Examples
Grid Data Set Edit