When using the example for batch editing on your website https://blazor.syncfusion.com/documentation/datagrid/editing/#batch-editing.
I try to double click on a column edit the value and press enter. When I do this the value gets saved and the focus goes to the column below it. This is good and the expected behaviour.
However when I set a Template on one of the GridColumn and hit enter the value does not get saved and the browser does not move to the next column. Only the focus inside the textbox gets lost.
E.g:
<SfGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Update", "Cancel" })">
<GridEditSettings AllowEditing="true" AllowAdding="true" Mode="EditMode.Batch"></GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"><Template> <div>test</div> </Template>
</GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
<GridEvents TValue="Order" OnBatchAdd="BeforeAdd" OnCellEdit="CellEdit"></GridEvents>
</SfGrid>
@code {
List<Order> Orders { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 10).Select(x => new Order(1000 + x)
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI",
"ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = (new double[] { 2, 1, 4, 5, 3 })[new Random().Next(5)] * x,
OrderDate = (new DateTime[] { new DateTime(2019, 01, 01), new DateTime(2019, 01, 02) })[new Random().Next(2)]
}).ToList();
}
public void BeforeAdd(BeforeBatchAddArgs<Order> arg)
{
arg.DefaultData = new Order(0) { CustomerID = "Customer ID" };
}
public void CellEdit(CellEditArgs<Order> arg)
{
arg.Data = arg.Data ?? new Order(arg.RowData.OrderID)
{
CustomerID = arg.RowData.CustomerID,
Freight = arg.RowData.Freight,
OrderDate = arg.RowData.OrderDate
};
}
public class Order
{
public Order(int orderid) => OrderID = orderid;
public int OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
}
}