I’m using dynamic loading since I set load mode to “week”. So when I click on the agenda button nothing happens since agenda view only display events that have been parsed by scheduler.
For example if I open the scheduler today in week mode it displays “26 May 2014 – 1 Jun 2014”. If the user only has events for the 3th, 4th and 5th after clicking on the agenda button they won’t show up, since they weren’t parsed yet in week/month/day view.
So I used the “onBeforeViewChange” event to catch when the user is entering in agenda view to reload the scheduler.
I want to display in agenda view only events from 1 week ahead of the start date displayed in this mode. The problem is that I can’t find the way to set the from & to parameters.
I have been debugging the scheduler._load method and I found that it receives the “from” parameter correctly, but since I was using the week mode, the following line change the “from” value with the one that is defined in the week view (the scheduler doesn’t support an agenda mode):
from = this.date[this._load_mode + "_start"](new Date(from.valueOf()));
I made it work setting load mode to “month” in onBeforeViewChange event (before reloading the scheduler), but I’m retrieving events for 30 days from the DB only to display the ones that belongs to the week set in agenda view. Besides, I give the ability to navigate in agenda view by increments of one day, for example “1 Jun 2014 – 7 Jun 2014” when I click next “2 Jun 2014 – 8 Jun 2014” and so on. The downside is that on every change I’m retrieving events for 30 days, begining with the current start date in agenda view.
// if the user enter the agenda view reload data to be sure all events are going to be displayed
scheduler.attachEvent("onBeforeViewChange", function (old_mode, old_date, mode, date) {
if (mode === "agenda") {
scheduler.setLoadMode("month");
scheduler.config.agenda_start = date;
scheduler.config.agenda_end = scheduler.date.add(date, 7, "day");
reloadScheduler();
}
return true;
});
I also tried setting the scheduler.config.week_start in “onBeforeViewChange” but it didn’t work (seems to be undefined).
How can I achieve this functionality?
Thanks in advance!