<SfGrid @ref="GridInstance" AllowPaging="true" DataSource="@Orders" Toolbar="@(new List<string>() { "Cancel", "Update" })">
<GridEditSettings AllowEditing="true" ShowConfirmDialog="false" Mode="EditMode.Batch"></GridEditSettings>
<GridEvents CellSelected="CellSelectHandler" CellSaved="Saved" TValue="Order"></GridEvents>
. . . . . .
</SfGrid>
@code{
SfGrid<Order> GridInstance { get; set; }
public async Task Saved(CellSaveArgs<Order> Args)
{
await GridInstance.EndEdit();
} |
<SfGrid @ref="GridInstance" AllowPaging="true" DataSource="@Orders" Toolbar="@(new List<string>() { "Cancel", "Update" })">
<GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Both"></GridSelectionSettings>
<GridEditSettings AllowEditing="true" ShowConfirmDialog="false" Mode="EditMode.Batch"></GridEditSettings>
<GridEvents CellSaved="CellSaved" TValue="Order"></GridEvents>
</SfGrid>
@code{
SfGrid<Order> GridInstance { get; set; }
async Task CellSaved(CellSaveArgs<Order> e)
{
if (!object.Equals(e.Value, e.PreviousValue))
{
await GridInstance.EndEdit();
// get the row index using the primarykey value
var RowIndex = await GridInstance.GetRowIndexByPrimaryKey(e.RowData.OrderID);
// edit the selected cell using the cell index and column name
await GridInstance.EditCell(RowIndex + 1, e.ColumnName);
}
}
|