Skip to main content

ASPxClientGridViewBatchEditApi.DeleteRow(visibleIndex) Method

Marks the specified row as deleted in batch edit mode.

Declaration

DeleteRow(
    visibleIndex: number
): void

Parameters

Name Type Description
visibleIndex number

The row’s visible index.

Remarks

The batchEditApi.DeleteRow method deletes the specified row on the client side. In this case, the grid marks this row as deleted and allows you to recover it before the grid sends changes to the server.

<dx:ASPxGridView ID="Grid" ClientInstanceName="ClientGrid" runat="server" KeyFieldName="ProductID">
    <!-- ... -->
    <SettingsEditing Mode="Batch" />
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="DeleteButton" runat="server" Text="Delete rows" AutoPostBack="false">
    <ClientSideEvents Click="OnDeleteButtonClick" />
</dx:ASPxButton>
function OnDeleteButtonClick(s, e) {
    var batchApi = ClientGrid.batchEditApi;
    var rowVisibleIndices = batchApi.GetRowVisibleIndices(true);
    for (var i = 0; i < rowVisibleIndices.length; i++) {
        var visibleIndex = rowVisibleIndices[i];
        if (ClientGrid.IsRowSelectedOnPage(visibleIndex)) {
            batchApi.DeleteRow(visibleIndex);
        }
    }
}
See Also