We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Resource schedule created with no current view dates

Hello,

I'm trying to load dynamically my events from an API but I can't use provided adaptators so I do it manually. I'm catching create and actionComplete events from scheduleObj to get current view dates and refresh my events, and it works well on a simple schedule. 


Things got complicated with a resource schedule, seems like it is longer to init : when catching create event from scheduleObj, no currentViewDates are available. But when catching actionComplete events, dates are available so I can refresh my events.


See stackblitz below to illustrate my concern: https://stackblitz.com/edit/angular-gxsfpc?file=app.component.html,app.component.ts

How could I get current view dates from a resource schedule just after it has been created?


Thanks for your response!


1 Reply 1 reply marked as answer

RM Ruksar Moosa Sait Syncfusion Team December 1, 2022 10:43 AM UTC

Hi Carla,


We suggest you use dataBound event instead created to get the current view dates by using the flag variable like the below code to meet your requirement.


Sample: https://stackblitz.com/edit/angular-gxsfpc-oobapb?file=app.component.ts


[app.component.html]

<ejs-schedule

      #scheduleObj

      cssClass="schedule-resource"

      width="100%"

      height="650px"

      [selectedDate]="selectedDate"

      [eventSettings]="eventSettings"

      (actionComplete)="printDates()"

      (dataBound)="bound()"
</ejs-schedule>


[app.component.ts]

public flagBoolean = true;

bound(): void {

    if (this.flag) {

      this.flag = false;

      console.log(this.scheduleObj.getCurrentViewDates());

    }

  }

  printDates(): void {

    if (!this.flag) {

      console.log(this.scheduleObj.getCurrentViewDates());

    }

  }


Regards,

Ruksar Moosa Sait


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon