I’m using a calendar in a modal and am showing the month view initially. I want to switch to day view when a date is clicked on. How do I achieve that?
There is no such an event available in the calendar.
OK, if I can’t switch the view, can I select the date that’s clicked on? This would enable the user to view a month, click on a date and then switch to day or week view and see the selected days.
Yes you can use the dynamic events for that. On date click - go to date - selected date from the click event.
Excellent. I keep forgetting about the click event at the top of the list. That now works nicely.
Regarding switching the view, can this be done with vanilla javascript?
Did you ever figure out how to switch view when choosing date?
Nope, sadly not.
could have two different calendars, ie two different pages: calendarMonth.html and then calendarDayView.html, and then have the link on event load the other page? Kind of bounce back and forth between the two etc?
Hmm, an interesting suggestion. Seems a bit overkill when I would have thought it possible to just add an action to do it. Might give that a go, though. Cheers.
You can write a function to go to the view by clicking on the button…
function goToView(view){
$(view).click()
}
And pass the button class to the function in the date click…
dmx-on:dateclick="run([{runJS:{outputType:'text',function:'goToView',args:['.fc-dayGridDay-button']}},{run:{outputType:'text',action:calendar1.gotoDate($event.date)}}])"