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

Set properties on scheduler

From Angular, I want to update the interval property of the schedule component.

I am trying this:
@ViewChild('schedule', { static: false }) public schedule: ScheduleComponent;
...
this.schedule.setProperties({ interval: value });

But this change is not reflected, even if I do 
this.schedule.refresh();

When the schedule refreshes after this, the change is successfully reflected.

What is the right way to directly update a property?



4 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team September 26, 2019 07:17 AM UTC

 
Syncfusion greetings. 
 
In the below sample, we have changed the Day view interval based on drop down field value. 
 
public onViewIntervalChange(args: any): void { 
    this.scheduleObj.views = [ 
      { option: 'Day', interval: args.value }]; 
  } 
 
Regards, 
Karthi 
 



JV Jan van Rossum September 26, 2019 07:53 AM UTC

Hi Karthigeyan,

Thanks for your reply.
After some experimenting I got it working.
I think it's a bit laborious from an Angular point of view...
Also I didn't get it to work without calling .refresh().
In your example that was not necessary, do you have an idea why? 
Can it be caused by the Timeline view?

Here is the code:

In .html:
<ejs-schedule #schedule [views]="views">

In .ts:
@ViewChild('schedule', { static: false }) public schedule: ScheduleComponent;
...
private getViews(): ViewsModel[] {
return [
{
option: 'TimelineWeek',
interval: this.interval
}
];
}
...
views = this.getViews();
...
_interval = 4;
get interval() {
return this._interval;
}
set interval(value) {
this._interval = value;
this.schedule.views = this.getViews();
this.schedule.refresh();
}



JV Jan van Rossum September 26, 2019 12:18 PM UTC

Found the bug in my implementation, refresh() is not necessary anymore.
Thanks for your help!


KK Karthigeyan Krishnamurthi Syncfusion Team September 27, 2019 04:25 AM UTC

Most welcome 😊 


Loader.
Live Chat Icon For mobile
Up arrow icon