Search code examples
kendo-uikendo-scheduler

Kendo-Scheduler: How can I make agenda view limit to 7 days?


Is it possible to limit the Kendo-Scheduler agenda view to only 7 days (e.g. from Monday to Sunday) as opposed to Monday - Monday for instance?

Week View enter image description here

Agenda View enter image description here


Solution

  • Try something like this:

    views: [
              { type: "week" },
              { type: customAgenda, title: "Agenda" }
    ],
    
    var customAgenda = kendo.ui.AgendaView.extend({
            endDate: function () {
                var date = kendo.ui.AgendaView.fn.endDate.call(this);
                return kendo.date.addDays(date, 7); // take the date and add 7 next days
            }
        });
    

    You need to be sure that var date is the Monday that you want to show. For instance:

    var date = Mon Mar 08 2015 00:00:00 GMT+0100 (Romance Standard Time)