This is a migrated thread and some comments may be shown as answers.

Reloading/Refreshing Highlighted Dates

1 Answer 203 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Erik Stell
Top achievements
Rank 1
Erik Stell asked on 26 Mar 2015, 08:06 PM
I have a form that has a standard datepicker that highlights specific dates.  Based on the example in the demo section, this is what the control is set up as:
      .HtmlAttributes(new {style = "width: 100%;"})
      .Footer("Today - #=kendo.toString(data, 'd') #")
      .MonthTemplate("# if ($.inArray(, events) != -1) { #" +
                     "<div class='" +
                     "# if (data.value > 0) { #" +
                     "order" +
                     "# } #" +
                     "'>#= data.value #</div>" +
                     "# } else { #" +
                     "#= data.value #" +
                     "# } #"))

In the Javascript, I have this:

var today = new Date(),
    events = [];
    url: "GetOrderDates?shipOrderNbr=" + $("#shiporder").val(),
    dataType: "json",
    success: function (result) {
        events = []; //clear the array of any preexisting dates that may have been loaded
        $.each(result, function (index, value) {
            events.push(new Date(value)); //01/01/2015, etc

The above code works; the ajax call returns a collection of strings that are all parsed into date objects and pushed in the the events array.

However, at any given time, the collection of dates can change depending on the users input.  However, once the datepicker control is initialized, changing the dates array doesn't refresh the highlighted dates in the control (in effect, once the MonthTemplate is rendered, it never reloads).

Is there a way to dynamically change the highlighted dates client side?

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 30 Mar 2015, 05:12 PM

There isn't a method specifically for refreshing the current calendar view but it is possible to use the setOptions method for this purpose.


See What's Next in App Development. Register for TelerikNEXT.

Date/Time Pickers
Asked by
Erik Stell
Top achievements
Rank 1
Answers by
Telerik team
Share this question