ASPxClientGridViewBatchEditApi.IsNewRow(visibleIndex) Method
Indicates whether the specified row is newly inserted.
Declaration
IsNewRow(
visibleIndex: number
): boolean
Parameters
Name | Type | Description |
---|---|---|
visibleIndex | number | The row’s visible index. |
Returns
Type | Description |
---|---|
boolean |
|
Remarks
Call the IsNewRow
method to determine if the specified row is newly inserted.
The code sample below deletes new rows that have no values in the ProductName column.
<dx:ASPxGridView ID="Grid" ClientInstanceName="ClientGrid" runat="server" AutoGenerateColumns="false" ...>
<Columns>
<dx:GridViewDataTextColumn FieldName="ProductName"/>
<!-- ... -->
</Columns>
<SettingsEditing Mode="Batch" />
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="DeleteButton" runat="server" Text="Delete new empty 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 (batchApi.IsNewRow(visibleIndex) && batchApi.GetCellValue(visibleIndex, "ProductName") === null) {
batchApi.DeleteRow(visibleIndex);
}
}
}
See Also