ant-design-blazor
ant-design-blazor copied to clipboard
DatePicker: picker value not updated
Describe the bug
The picker value is not updated if the Value of a <DatePicker> is changed programmatically.
Steps to reproduce (please include code)
<DatePicker
@bind-Value="_date"
TValue="DateTime"
Picker="@DatePickerType.Date"
/>
<Button Type="primary" OnClick="OnClick">Test</Button>
@code
{
DateTime _date = DateTime.Today;
void OnClick()
{
_date = new DateTime(2021, 2, 15);
}
}
If you click the "Test" button value of the <DatePicker> is changed to DateTime(2021, 2, 15)
, however, the picker still stays on previous value DateTime.Today
if you open it.
Actually, for a <DatePicker> or <RangePicker>, any changes make to their Value programmatically after OnAfterRender will not affect the picker, you must directly click date values on the picker panels, that should be a bug.
Further technical details
- AntDesign Nuget Package version: 0.11.0
- Include the output of
dotnet --info
: 5.0 - The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version: Visual Studio 2022 Community
Hi @Alexbits , may I ask whether this problem has been fixed in the previous PR?
Hi @Alexbits, may I ask whether this problem has been fixed in the previous PR?
Hey @ElderJames, it's not. From what I see, the Value of DatePicker is updated, but sometimes, it does not re-render to show the change. I will check this later.
Ok, thanks so much!