Reloading/Refreshing Highlighted Dates

2 posts, 0 answers
  1. Erik Stell
    Erik Stell avatar
    11 posts
    Member since:
    Dec 2013

    Posted 26 Mar 2015 Link to this post

    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?
  2. Daniel
    Daniel avatar
    2125 posts

    Posted 30 Mar 2015 Link to this post


    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.

Back to Top