I am using FullCalendar vue component.
I have 2 calendars with different options, I need to change the view of second calendar whenever the first calendar's view is changed.
I am trying to use "datesSet" to achieve this but its not working.
here is my code:
<template>
<FullCalendar ref="fullCalendar" :options="srcCalendar" />
<FullCalendar ref="fullCalendarDest" :options="destCalendar" />
</template>
<script>
import FullCalendar from '@fullcalendar/vue'
export default {
components: { FullCalendar},
data() {
return {
srcCalendar: {
headerToolbar: {
start: 'title prev next',
center: 'resourceTimelineMonth resourceTimelineWeek resourceTimelineDay',
end: 'today'
},
datesSet: this.handleDatesSetSrcCalendar,
},
destCalendar: {
headerToolbar: {
start: 'title prev next',
center: 'resourceTimelineMonth resourceTimelineWeek resourceTimelineDay',
end: 'today'
},
},
}
},
methods: {
handleDatesSetSrcCalendar(currentViewType, destCalendar){
console.log("handleDatesSetSrcCalendar");
const viewType = this.$refs.fullCalendar.getApi().view.type;
let isChanged = false;
if (currentViewType == null) {
currentViewType = viewType;
}
if (currentViewType !== viewType) {
isChanged = true;
}
if (isChanged) {
currentViewType = viewType;
console.log('src viewType', viewType)
this.$refs.fullCalendarDest.getApi().changeView(viewType);
}
return [];
},
},
</script>
Please help me understand where is my mistake.
Thank you!