- Home
- Forum
- Angular - EJ 2
- Set properties on scheduler
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?
SIGN IN To post a reply.
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 😊
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
JV Jan van Rossum
- Sep 25, 2019 03:16 PM UTC
- Sep 27, 2019 04:25 AM UTC