Anuradha Gunasekara
Anuradha Gunasekara

Reputation: 6983

how to disable dates in kendo date time picker (Angular)

<input id="startDate" kendo-date-time-picker
           k-ng-model="vm.startDate"
           k-on-change="vm.updateStartDate()"
           required
/>

How to add disabled dates to this date picker? Not using jquery !! Is there a attribute as k-disabled-dates?

Upvotes: 0

Views: 2048

Answers (1)

The Dread Pirate Stephen
The Dread Pirate Stephen

Reputation: 3169

Specify the k-options attribute:

<input id="startDate" kendo-date-time-picker
       k-ng-model="vm.startDate"
       k-on-change="vm.updateStartDate()"
       required,
       k-options="startDateOptions"
/>

And then implement the options with the disabledDates(http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker#configuration-disableDates) config specified however is appropriate for your situation, i.e.

$scope.startDateOptions = {
    disableDates: function (date) {
        var disabled = [13,14,20,21];
        if (date && disabled.indexOf(date.getDate()) > -1 ) {
            return true;
        } else {
            return false;
        }
    }
};

Example: http://dojo.telerik.com/@Stephen/eLuWE

Upvotes: 1

Related Questions