使用月视图,逐周移动而不是逐月移动 [英] Using month view, move week by week instead of month by month

查看:93
本文介绍了使用月视图,逐周移动而不是逐月移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FullCalendar v2.2.5,并且当日历使用的是月份视图时,我想每周浏览一次 而不是 / em>。



我看到用于向前导航的函数是,但我无法想出一个方法来改变这种行为。



有什么办法可以达到这个目的?

p>

解决方案

默认情况下,如 prev 下一步 文档:


如果日历在月如果日历处于basicWeek或agendaWeek中,则会将日历向后/向前移动一周。



如果日历处于basicDay或agendaDay中,则会将日历返回/前进一天。


如果您想更改如何运作,您需要使用 自定义视图 ,基于月视图。例如:

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

基本上,你创建一个 customMonth 基于月份视图和持续时间这是一周。
我已经制作了 jsfiddle ,您可以在其中看到此功能。



完全披露:此解决方案基于此答案


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?

解决方案

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.

这篇关于使用月视图,逐周移动而不是逐月移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆