refresh schedule with resources

Hello, 

I'm looking for a way to correctly refresh my schedule which includes resources.

Currently I have something like this : with the select above I can choose a team of employees and display their schedule.
When I change the teams with the select, It should change the displayed resources (Employees) and Appointment according to the teams I've chosen

However when I choose a new Team it is not refreshing well and I have this error: 
           


My refresh function looks like this :
  async refreshSchedule(){
    this.Loader=true;

    this.resourceDataSource=[]      //resources data source of the schedule
    this.CalendarData=[];           //data loaded from an API to create the appointment
    this.TeamsCollaborators=[];     //Employees format : {Name :   , Id :    , Color:   }        


    this.LoadCollaborators(this.Forms.get('selectedTeam').value).then(res=>{
      console.log(this.scheduleObj);
      this.resourceDataSource=this.TeamsCollaborators;
      this.scheduleObj.eventSettings.dataSource=this.CalendarData;
      this.scheduleObj.changeDate(new Date());
      this.scheduleObj.refresh();
      this.Loader=false;
    });

  }

is there a better way to refresh this kind of schedule ?

Regards,
William



3 Replies 1 reply marked as answer

HB Hareesh Balasubramanian Syncfusion Team November 10, 2020 11:23 AM UTC

Hi Guilbaud, 

Greetings from Syncfusion Support..! 

We have prepared a sample based on your shared query “When I change the teams with the select, It should change the displayed resources (Employees) and Appointment according to the teams I've chosen” using resources property of the Scheduler, change event of the Dropdown component which can be viewed from the following link. 


  public onChange(args: any): void { 
    if (args.itemData.Id == "Team1") { 
      (this.scheduleObj as any).resources[0].dataSource = this.team1; 
    } else if (args.itemData.Id == "Team2") { 
      (this.scheduleObj as any).resources[0].dataSource = this.team2; 
    } else { 
      (this.scheduleObj as any).resources[0].dataSource = this.team3; 
    } 
  } 

Kindly try the above solution and get back to us if you need any further assistance. 

Regards, 
Hareesh 


Marked as answer

GW Guilbaud William November 10, 2020 02:18 PM UTC

Thanks for your quick reply and for the solution providing : it works as expected !




NR Nevitha Ravi Syncfusion Team November 11, 2020 05:19 AM UTC

Hi Guilbaud, 

You are most welcome 😊. Please get back to us if you need any further assistance. 

Regards, 
Nevitha 


Loader.
Up arrow icon