Search code examples
javascriptangularkendo-ui-angular2kendo-datepicker

how to open the kendo angular datepicker popup using javascript


i cant find a way to open the kendo angular(2+) datepicker from JS.

i want to have my own datepicker icon , hiding the default controller ( input field and icon using visibility: hidden; ) and to open the popup when my icon is clicked.

in the api doc i can find only blur and focus Methods

https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/DatePickerComponent/#toc-blur

thanks


Solution

  • You can use following code to toggle the visibility of the date-picker (use this code in your icon click event);

    datepicker.toggle()
    

    example;

     <button (click)="datepicker1.toggle()">toggle date picker</button>
     <kendo-datepicker #datepicker1></kendo-datepicker>