Error GridEdit DateTime and Time
Hi,
Attachment: SyncError_76a761f9.zip
saving Datetime / Time data in a grid I came across 2 errors:
1. When saving a date and time with EditMode.Dialog and the provided form, 4 hours are added - even if you do not change the date value. (see attached video and DataGrid sample)
2. Creating a custom edit dialog with a TimePicker (which is the control I actually have to use) the edit window is not closed when saving and the OnActionComplete event is not reached.
In another programm I noticed, that the changed DateTime data is not updated in OnActionComplete in the data property with the TimePicker control.The DateTimePicker updates the data, but adds 4 hours.
I am working with a german win 10 prof in Server Side Blazor with 18.1.0.55
Maybe you can take a look.
regards
Uwe
Attachment: SyncError_76a761f9.zip
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
June 8, 2020 06:40 AM UTC
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
Kindly get back to us if you have further queries.
Regards,
Vignesh Natarajan
Marked as answer
UH
Uwe Hein
June 8, 2020 08:45 AM UTC
Hi Vignesh,
thank you for the really fast response - your workaround cures the problem for now.
Two last Questions:
1. What is the correct event to call when saving in Grid ?
I always thought it was OnActionComplete, but you suggested OnActionBegin.
2. What is the correct event to call when saving in Scheduler ?
OnActionBegin or ActionCompleted
Thanks again
regards
Uwe
VN
Vignesh Natarajan
Syncfusion Team
June 9, 2020 10:19 AM UTC
Thanks for the update.
Query: “What is the correct event to call when saving in Grid ? I always thought it was OnActionComplete, but you suggested OnActionBegin.”
OnActionBegin event will be triggered when certain action is initiated and OnActionComplete event will triggered when certain action is completed. So to save / reflect the changes in Grid, we need to change the values in OnActionBegin event. We suggest you to achieve your requirement (to change the date object value) using OnActionBegin event of Grid when RequestType as Save.
Query: “What is the correct event to call when saving in Scheduler ? ”
We suggest you to use Scheduler ActionCompleted event which is appropriate event to save events in Scheduler. Refer the below documentation link for that.
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
UH Uwe Hein
- Jun 6, 2020 04:38 PM UTC
- Jun 9, 2020 10:19 AM UTC