Clear date value (set to null) from API

I am trying to set DatePicke value to null (to clear date user picked already) from code behind.

Here is minimal sample

<EjsDatePicker TValue="DateTime?" ShowClearButton="true" ShowTodayButton="true" Format="dd.MM.yyyy" Placeholder="Odaberte novi datum" @bind-Value="@NoviDatum"></EjsDatePicker>
<button @onclick="resetDate">Reset date</button>
@code  {
    DateTime? NoviDatum;
    private void resetDate()
    {
        NoviDatum = null;
    }
}

On this page , first pickup date 
Then click Reset date button 
After first click date picker will still have date on it.
After second click on resetDate date picker will clera selected date.

Is there a way to push DatePicker to reset its value from codebehind.




1 Reply

BC Berly Christopher Syncfusion Team March 4, 2020 04:43 AM UTC

Hi Admir, 
  
Greetings from Syncfusion support.  
  
This is already known issue “Need to click the external button twice to clear the value from the DatePicker” at our end and this issue has been fixed in the today’s patch release. So, we suggest you to upgrade the Syncfusion NuGet and script to the latest version “17.4.54” to get rid of the reported issue at your end.  
  
  
Script: 
<link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.4.54/material.css" rel="stylesheet" /> 
 <script src="https://cdn.syncfusion.com/ej2/17.4.54/dist/ej2.min.js"></script> 
 <script src="https://cdn.syncfusion.com/ej2/17.4.54/dist/ejs.interop.min.js"></script> 
 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon