Hi Uwe,
Thanks for contacting Syncfusion support.
Query1: “When saving a date and time with EditMode.Dialog and the provided form, 4 hours are added”
We have validated your query and since it is a known issue, we have confirmed this as a defect “Timezone issue occurs while updating datetime column in grid blazor component” and logged a defect report for the same. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming 2020 Volume 2 Main Release which is expected to be rolled out in the month end of June 2020.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Till then as a workaround, we suggest you to add the time difference the in OnActionBegin event of Grid while saving the changes. Refer the below code example.
|
<SfGrid ID="Grid"
DataSource="@Orders"
. . . .
Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update","ExcelExport"})" Height="315" Width="900">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog"></GridEditSettings>
<GridEvents OnActionBegin="Begin" TValue=Order></GridEvents>
. . . . . .
</SfGrid>
</div>
<br />
@code
{
public List<Order> Orders { get; set; }
SfGrid<Order> Grid;
public void Begin(ActionEventArgs<Order> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
// remove the time difference from original while saving the changes.
Args.Data.OrderDate = Args.Data.OrderDate.Value.AddHours(-6); // give the value based on yours
}
}
|
Query2: “the edit window is not closed when saving and the OnActionComplete event is not reached.”
We have analyzed the reported issue and found that you have enabled ColumnValidation in OrderID and CustomerID column. But you have not defined the controls in Template. Hence the reported issue occur while saving the changes. So kindly ensure to add the controls in Dialog Template that are defined in GridColumns with validation, if you want to perform validation in Grid Column. Kindly use style (display – none or visibility - hidden) to hide the section from Dialog Template.
Refer the below code example
| <GridEditSettings AllowAdding="false" AllowEditing="true" AllowDeleting="false" Mode="EditMode.Dialog"> <Template> @{ var rowData = (context as Order1); <div style="visibility:hidden"> <SfTextBox ID="OrderID" Value="@(rowData.OrderID.ToString())" Enabled="false"></SfTextBox> <SfTextBox ID="CustomerID" Value="@(rowData.CustomerID)"></SfTextBox> </div> <div class="form-group col-md-12"> <SfTimePicker ID="OrderDate" TValue="DateTime?" Value="@(rowData.OrderDate)" Format="HH:mm"> </SfTimePicker> </div> } </Template>
<GridColumns> <GridColumn Field=@nameof(Order1.OrderID) HeaderText="Order ID" IsPrimaryKey="true" ValidationRules="@(new { required=true})" TextAlign="TextAlign.Right" Width="120"></GridColumn> <GridColumn Field=@nameof(Order1.CustomerID) HeaderText="Customer Name" ValidationRules="@(new { required=true})" Width="120"></GridColumn> <GridColumn Field=@nameof(Order1.OrderDate) HeaderText=" Order Date" TextAlign="TextAlign.Right" Width="130" EditType="EditType.DateTimePickerEdit"></GridColumn> <GridColumn Field=@nameof(Order1.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" EditType="EditType.NumericEdit" Width="120"></GridColumn> <GridColumn Field=@nameof(Order1.ShipCountry) HeaderText="Ship Country" EditType="EditType.DropDownEdit" Width="150"></GridColumn></GridColumns>
|
Kindly get back to us if you have further queries.
Regards,
Vignesh Natarajan