How to set the defaultView of fullCalendar in Meteor?

拜拜、爱过 提交于 2019-12-13 02:43:06

问题


I am using fullCalendar package to add calendar in my project. By default the view shows by months and I want to change it to weekly bases.

From fullCalendar documentation, agendaWeekis what I am looking for.

I tried the following (didn't work):

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

When I create button and add the following event to it:

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

It works and the calendar changes.

My question is, how can set the calendar view to agendaWeek by default?

It would even be better if there is a way to make it similar to the calendar in their official page were there are three buttons (month, week, and day) buttons to choose from.


回答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 is the jsfiddle for it.



来源:https://stackoverflow.com/questions/47895333/how-to-set-the-defaultview-of-fullcalendar-in-meteor

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