Hello together,
currently we have following problem:
for the scheduler we have buttons to switch between following views:
week: current week from Monday to Sunday
month: current month seeing all days of the month
year: current year seeing all months
If we now switch from week to year and then back to week again the month view is visible.
Any ideas why this happens?
Here our ViewPresets for week, month and year:
export const week = new ViewPreset({
id: 'week',
name: 'Week',
displayDateFormat: 'll',
timeResolution: {
unit: 'day'
},
headers: [
{
unit: 'day',
dateFormat: 'DD MMM'
}
]
});
export const month = new ViewPreset({
id: 'month', // Unique id value provided to recognize your view preset. Not required, but having it you can simply set new view preset by id: scheduler.viewPreset = 'myPreset'
name: 'Month', // A human-readable name provided to be used in GUI, e.i. preset picker, etc.
timeResolution: {
unit: 'day'
},
headers: [
{
unit: 'day',
dateFormat: 'DD MMM'
}
]
});
export const year = new ViewPreset({
id: 'year', // Unique id value provided to recognize your view preset. Not required, but having it you can simply set new view preset by id: scheduler.viewPreset = 'myPreset'
name: 'Year', // A human-readable name provided to be used in GUI, e.i. preset picker, etc.
timeResolution: {
unit: 'day'
},
headers: [
{
unit: 'day',
dateFormat: 'MMMM YY'
}
]
});
Here is the function for switching between modes:
ngOnInit(): void {
PresetManager.add([week, month, year]);
}
// schedulerMode is either 'week', 'month' or 'year'
onChangeSchedulerMode(schedulerMode: SchedulerMode) {
switch (schedulerMode) {
case SchedulerMode.week:
this.scheduler.setTimeSpan(
moment().startOf('isoWeek').toDate(),
moment().endOf('isoWeek').toDate()
);
break;
case SchedulerMode.month:
this.scheduler.setTimeSpan(
moment().startOf('month').toDate(),
moment().endOf('month').toDate()
);
break;
case SchedulerMode.year:
this.scheduler.setTimeSpan(
moment().startOf('year').toDate(),
moment().endOf('year').toDate()
);
break;
}
this.scheduler.viewPreset = schedulerMode.toString();
}
Thank you in advance and best regards!