jqueryangularjskendo-uikendo-datepicker

toggle kendo date calender container on click of input box


I have a kendo Date picker it is functioning well.

On click of icon beside to input box, I am able to open date dialog for calender and it is working. But I want this dialog should also open onclick of input box..

            <h4>Select date:</h4>
            <input kendo-date-picker
             ng-model="dateString"
             k-ng-model="dateObject" />

What I have tried :

angular.element('#common_datePicker').on('click', function () {
                            var datePicker = angular.element('#common_datePicker').data('kendoDatePicker');
                            if ($('.k-calendar-container').css('display') == 'none'){
                                datePicker.open();
                            } else {
                                datePicker.close();
                            }
                        });

On click of input box I am able to open the Calender container but again on clicking of this it should close. It should be working as a toggle. In this link they talk about API related to kendo datepicker..

http://demos.telerik.com/kendo-ui/datepicker/api

Can anyone guide me ?


Solution

  • Here is the answer..

    I did some R&D and find this solution..

                    // On click of input box of date control open and close the calender control
                    angular.element('#common_datePicker').on('click', function () {
                        var datePicker = angular.element('#common_datePicker').data('kendoDatePicker');
                        if ($('#common_datePicker_dateview').css('display') == 'none') {
                            datePicker.open();
                        } else {
                            datePicker.close();
                        }
                    });
    

    And this is working fine for me. Thanks!!