Our pure JavaScript Scheduler component


Post by MichaelZhu »

Hi,

I'd like to load data from server when selected date changed.
Bellow is the code snip:

                <scheduler-pro
                  ref="scheduler"
                  :startDate="startDate"
                  :endDate="endDate"
                  :config="productionPlanConfig"
                  :resource-time-ranges-feature="true"
                  :auto-adjust-time-axis="true"
                  :zoom-on-mouse-wheel="true"
                  :zoom-on-time-axis-double-click="true"
                  event-layout="pack"
                  :height="height"
                />
  watch: {
    myDate(newVal) {
      this.startDate = this.$moment(newVal)
        .startOf("month")
        .toDate();
      this.endDate = this.$moment(newVal)
        .endOf("month")
        .add(1, "days")
        .toDate();

  const schedulerInstance = this.$refs.scheduler.schedulerInstance;
  // schedulerInstance.suspendRefresh();

  schedulerInstance.project.load({ date: this.$moment(newVal).format('yyyy-MM-DDTHH:mm:ss') }).then(() => {
    console.log(schedulerInstance);
    schedulerInstance.timeAxis.startDate = this.startDate;
    schedulerInstance.timeAxis.endDate = this.endDate;
    // schedulerInstance.resumeRefresh(false);
  });
}
  }

The scheduler does render the UI when call the load() method first time but rendered after call the load() second time.

First time

1.png
1.png (168.59 KiB) Viewed 406 times

Second time

2.png
2.png (230.39 KiB) Viewed 406 times

Regards


Post by mats »

Instead of

schedulerInstance.timeAxis.startDate = this.startDate;
    schedulerInstance.timeAxis.endDate = this.endDate;

Please use https://bryntum.com/docs/scheduler/#Scheduler/view/Scheduler#function-setTimeSpan

Does this fix it?


Post by MichaelZhu »

Hi Mats,

It is OK now if there're events load from server first time. But still not work when retreved an empty array from server.
Step1 load from server and got empty events
Step2 load from server, got events but the events not render
Step3 load from server, got events and rendered

Regards


Post by mats »

Could you please provide a simple test case? (ZIP up and upload in this thread)


Post Reply