0

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 ?

4

3 回答 3

1

这是答案..

我做了一些研发并找到了这个解决方案..

                // 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();
                    }
                });

这对我来说很好。谢谢!!

于 2015-01-31T07:45:39.867 回答
0

我为此创建了一个指令...

myApp.directive('kendoDatePicker', [
  function () {
    return {
      link: function (scope, element, attr) {
        element.bind('click', function (event) {
          var datePicker = $(element).data("kendoDatePicker");
          datePicker.open();
        });
      }
    };
  }]);

于 2020-09-16T08:41:21.777 回答
0

这是 Javascript Coder 解决方案的 JQuery 版本

$("#yourDatePickerInputId").on('click', function () {
    var datePicker = $('#yourDatePickerInputId').data("kendoDatePicker");
    if ($('#yourDatePickerInputId_dateview').css('display') == 'none') {
        datePicker.open();
    } else {
        datePicker.close();
    }
});
于 2016-05-05T22:47:21.300 回答