DatePicker Dynamic Binding fails after Date Picked
Hi,
I have had an issue with the DatePicker.
My fault finding led me to using the very basic example in the "documentation/datepicker/data-binding/" with the addition of a dropdown that changes the value of the variable being used as the value of the DatePicker.
The DropDown is populated with 3 dates. It is possible to use the DropDown repeatedly to change the value of the DatePicker and the value shown in the <p> on the page.
So using the Dropdown works as expected until you use the DatePicker to select a date. Once this has been done, using the Dropdown to change the variable value has no effect on the DatePicker, but the value shown in the <p> on the page continues to show that the variable value is changing.
After the DatePicker becomes non responsive to the changes made by the DropDown, if you click on the DatePicker to expose the Calendar, it displays the currently selected date as the one in the variable rather than the one shown by the DatePicker as its current value.
I have carried out the same experiment with the Date|TimePicker and had the same results. However, with the DateTimePicker once it is not changing to show the value of the variable, if you then make a change to the time, the date will then update to show the value of the variable.
The code is below...
@page "/TestDatePickerChange"
@using Syncfusion.Blazor.Calendars;
@using Syncfusion.Blazor.DropDowns;
@using System.Collections.Generic;
<h3>TestDatePickerChange</h3>
<p>DatePicker value is: @DateValue</p>
<SfDatePicker TValue="DateTime?" Value="@DateValue">
<DatePickerEvents TValue="DateTime?" ValueChange="@onChange"></DatePickerEvents>
</SfDatePicker>
<br />
<br />
<SfDropDownList id="DirectionDropdownPlaceholder" Placeholder="Both" DataSource="@DropdownList" TValue="string" TItem="string">
<DropDownListEvents ValueChange="@DropDownChanged" TValue="string" TItem="string"></DropDownListEvents>
</SfDropDownList>
@code {
public DateTime? DateValue { get; set; } = DateTime.Now;
private void onChange(Syncfusion.Blazor.Calendars.ChangedEventArgs<DateTime?> args)
{
DateValue = args.Value;
StateHasChanged();
}
List<string> DropdownList = new List<string>{ "24/02/1922", "12/07/2000", "16/09/1996"};
public void DropDownChanged(@Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, string> args)
{
DateValue = DateTime.Parse(args.Value);
}
}
Is this a bug? or is there another way to cause the DatePicker to update?
Thanks and Happy Holidays - Martin
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
BC
Berly Christopher
Syncfusion Team
December 30, 2020 07:02 AM UTC
Hi Martin,
Greetings from Syncfusion support.
We have confirmed the reported issue as a bug at our end. This fix will be included in our next patch release scheduled on 6th January 2021. We appreciate your patience until then.
Please track the status of the issue from the below feedback.
Regards,
Berly B.C
Marked as answer
KH
koilte hight
March 18, 2023 10:37 AM UTC
hi.
How can use DateRangePicker in Grid. Save data in database. with Add and Edit Mode.
UD
UdhayaKumar Duraisamy
Syncfusion Team
March 21, 2023 08:45 AM UTC
You can follow the Syncfusion forum shared below regarding your requirement.
Syncfusion Forum: https://www.syncfusion.com/forums/175596
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
- Marked answer
-
MA Martin
- Dec 24, 2020 06:26 PM UTC
- Mar 21, 2023 08:45 AM UTC