如何在Meteor中设置fullCalendar的defaultView?

时间:2017-12-19 21:19:09

标签: meteor fullcalendar

我正在使用fullCalendar包在我的项目中添加日历。默认情况下,视图按月显示,我想将其更改为每周基数。

来自fullCalendar documentation,我正在寻找agendaWeek

我尝试了以下(不起作用):

$("#calendar").fullCalendar({
        defaultView: 'agendaWeek'
});

当我创建按钮并向其添加以下事件时:

Template.appointments.events({
    'click #check': function(e, t) {
        e.preventDefault()
        // console.log(Requests.find({}).fetch())
        $('#calendar').fullCalendar('changeView', 'agendaWeek');
    }
});

它有效并且日历会发生变化。

我的问题是,默认情况下如何将日历视图设置为agendaWeek

如果有一种方法可以让它与official page中的日历类似,如果有三个按钮(月,周和日)按钮可供选择,那就更好了。

1 个答案:

答案 0 :(得分:1)

$('#calendar').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay', // gets you the three button tabs that you were looking for, similar to the demo 
    },
    defaultView: 'agendaWeek' // default view is agendaWeek
});

Here是jsfiddle。

相关问题