DxDataGrid<T>.CancelRowEdit() Method
Asynchronously closes the edit form and does not save changes.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v22.1.dll
Declaration
public Task CancelRowEdit()
Returns
Type | Description |
---|---|
Task | An asynchronous operation that closes the edit form. |
Remarks
Important
The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.
Use the CancelRowEdit method to close the edit form and discard changes that users made. The RowEditCancel and RowEditCancelAsync events are fired when you call this method.
Note
This method does not discard changes that were accepted and passed to the data item.
The following code snippet demonstrates how to implement a custom Cancel button outside the Data Grid:
<button id="cancelButton" @onclick="@Cancel">Cancel</button>
<DxDataGrid DataAsync="@ForecastService.GetForecastAsync"
@ref="MyGrid" ...>
<DxDataGridColumn Field=@nameof(WeatherForecast.TemperatureC) Caption="Temp. (C)"></DxDataGridColumn>
...
</DxDataGrid>
@functions {
DevExpress.Blazor.DxDataGrid<WeatherForecast> MyGrid;
async Task Cancel() {
await MyGrid.CancelRowEdit();
}
}