Vue.js: Scheduler requests having the wrong period
5 years ago.
Dear Sir or Madam,
I'm evaluating your scheduler as vue.js component. Therefore I downloaded your example from the following page (Button "Download source"): https://code.daypilot.org/46517/vue-js-scheduler-changing-visible-date
The scheduler shall load its data from an API. So I made the following changes:
The methods for loading events and resources were changed.
loadEvents() {
this.scheduler.events.load("<myAPI>");
},
loadResources() {
this.scheduler.rows.load("<myAPI>");
}
I also changed the methods for switching the month:
previous() {
this.scheduler.startDate = this.scheduler.startDate.addMonths(-1);
this.scheduler.days = this.scheduler.startDate.daysInMonth();
this.loadEvents();
this.scheduler.update();
},
next() {
Vue.set(this.config, "startDate", this.config.startDate.addMonths(1));
Vue.set(this.config, "days", this.config.startDate.daysInMonth());
this.loadEvents();
this.scheduler.update();
}
The occurring error:
The scheduler requests the wrong period.
The scheduler starts with displaying November 2020, today is 18.11.2020. The requests contains the parameters start=2020-11-01T00:00:00&end=2020-12-01T00:00:00 (correct so far)
So I click the Button "next" and the next request is sent.
It's parameters: start=2020-11-01T00:00:00&end=2020-12-01T00:00:00
Expected: start=2020-12-01&end=2020-12-31
And a second click on "next" and a further request:
It's parameters: start=2020-12-01T00:00:00&end=2021-01-01T00:00:00
Expected: start=2021-01-01&end=2021-01-31
Conclusion
The parameters start and end for requesting events are wrong. It seems like the events are requested before the changes to start and end are made.
The file with my changes is attached.
Kind regards
Benny Luz
DayPilot