|
<SfGrid AllowPaging="true" DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<GridEditSettings AllowEditing="true" AllowDeleting="true" AllowAdding="true" Mode="@EditMode.Normal"></GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="@TextAlign.Center" Width="140"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" EditType="EditType.NumericEdit" Format="C2" Width="140" TextAlign="@TextAlign.Right"></GridColumn>
// Set the Column EditType
<GridColumn Field=@nameof(Order.OrderDate) EditType="EditType.DatePickerEdit" Format="dd/MM/yyyy" Type="ColumnType.Date" Width="120">
<EditTemplate>
<SfDatePicker ID="OrderDate" Value="@((context as Order).OrderDate)" TValue="DateTime?" Format="dd/MM/yyyy" Width="120">
<DatePickerEvents TValue="DateTime?" ValueChange="FabricApprovedActualDateChange"></DatePickerEvents>
</SfDatePicker>
</EditTemplate>
</GridColumn>
</GridColumns>
</SfGrid>
@code{
SfDatePicker<DateTime?> DatePicker { get; set; }
public List<Order> Orders { get; set; }
public class Order
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
[JsonConverter(typeof(CustomDateTimeConverter))]
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
}
class CustomDateTimeConverter : IsoDateTimeConverter
{
public CustomDateTimeConverter()
{
base.DateTimeFormat = "dd/MM/yyyy";
}
}
}
|
Hi Kuralarasan,
thanks for answering, the problem I mentioned and where I noticed the problem with edit and a save is not in my project you mentioned from the one of my previous posts.
( later I found out that same behavior happens with me also).
I was referring to the sample provided by Mr. Pavithra as a reply to Mr. John question:
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DateColumn995738293
The funny thing is that, in the upper sample, if you, for example, change text field with Customer name, it works fine, I only noticed this behavior with
date field.
I'm using Syncfusion.Blazor 18.1.0.59.
|
<EditTemplate>
<SfDatePicker ID="OrderDate" @bind-Value="@((context as Order).OrderDate)" TValue="DateTime?" Format="dd/MM/yyyy" Width="120">
<DatePickerEvents TValue="DateTime?" ValueChange="FabricApprovedActualDateChange"></DatePickerEvents>
</SfDatePicker>
</EditTemplate> |
Hi df,
Thanks for the details.
We are able to reproduce the issue while using your regional date settings. To resolve this issue, we suggest to use bind-Value value property in edit template datepicker (like as below code snippet) instead of Value.
<EditTemplate><SfDatePicker ID="OrderDate" @bind-Value="@((context as Order).OrderDate)" TValue="DateTime?" Format="dd/MM/yyyy" Width="120"><DatePickerEvents TValue="DateTime?" ValueChange="FabricApprovedActualDateChange"></DatePickerEvents></SfDatePicker></EditTemplate>
We have modified the sample for your reference and you can download it from the below link.
Regards,Kuralarasan M