ASPxClientGridViewBatchEditApi.DeleteRowByKey(key) Method
Marks the specified row as deleted in batch edit mode.
Declaration
DeleteRowByKey(
key: any
): void
Parameters
Name | Type | Description |
---|---|---|
key | any | The row’s key value. |
Remarks
The batchEditApi.DeleteRowByKey
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.batchEitApi;
var selectedRowKeys = ClientGrid.GetSelectedKeysOnPage();
for (var i = 0; i < selectedRowKeys.length; i++) {
var rowKey = selectedRowKeys[i];
batchApi.DeleteRowByKey(selectedRowKeys[i]);
}
}
See Also