Using month view, move week by week instead of month by month

一笑奈何 提交于 2020-01-05 03:03:08

问题


I am using FullCalendar v2.2.5 and I would like to navigate week by week instead of month by month when the calendar is using the month view.

I see that the function used to navigate forward is this but I wasn't able to figure a way to change this behaviour.

Is there any way to accomplish this?


回答1:


By default, as stated on prev and next documentation:

If the calendar is in month view, will move the calendar back/forward one month.

If the calendar is in basicWeek or agendaWeek, will move the calendar back/forward one week.

If the calendar is in basicDay or agendaDay, will move the calendar back/forward one day.

If you want to change the how that works, you'll need to use a Custom view, based on the month view. Something like:

$('#calendar').fullCalendar({
    defaultView: 'customMonth',
    views: {
        customMonth: {
            type: 'month',
            duration: {weeks: 1}
        }
    }
});

Basically, you "create" a customMonth view (which is the default view), based on the month view and the duration of this is one week. I've made a jsfiddle where you can see this working.

Full disclosure: This solution was found based on this answer.



来源:https://stackoverflow.com/questions/40215588/using-month-view-move-week-by-week-instead-of-month-by-month

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!