Yurii N.
Yurii N.

Reputation: 5703

Disable dates in Kendo Calendar after the initialization

I have simple Kendo calendar, where I can disable dates at the moment of its initialization:

$("#simpleCalendar").kendoCalendar({
    disableDates: ["sa", "su"]
});

How could I disable specified dates, after the initialization of this calendar?

Upvotes: 0

Views: 2180

Answers (2)

Satpal
Satpal

Reputation: 133403

You can use disableDates accept a function also to determine which dates to be disabled.

$("#simpleCalendar").kendoCalendar({
    disableDates: function (date) {
       //Test date 
       var disabled = [2,4,6,8];
       return date && disabled.indexOf(date.getDate()) > -1;
    }
});

You can also use setOption to change the initial DatePicker configuration.

$("#simpleCalendar").data("kendoCalendar").setOptions({
    disableDates: ["sa", "su", new Date(2015, 9, 12), new Date(2015, 9, 22)]
});

Upvotes: 1

R.K.Saini
R.K.Saini

Reputation: 2708

You just need to re-initialize the calendar. Before doing that you need to clear content of previous calender

$("#changeBtn").click(function(){
    $("#calendar").empty();
    $("#calendar").kendoCalendar({
        disableDates: ["mo", "tu"]
    });
});

here is a working demo http://dojo.telerik.com/IMOlI

Upvotes: 1

Related Questions