如何在Meteor中设置fullCalendar的defaultView? [英] How to set the defaultView of fullCalendar in Meteor?
问题描述
我正在使用 fullCalendar 包在我的项目中添加日历。默认情况下,该视图按月显示,我想将其更改为每周基数。
来自fullCalendar 文档, 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
?
它甚至会更好有一种方法可以使它与官方页面中的日历类似,只要有三个按钮(
$('#日历')。fullCalendar({
header:{
left:'prev,next today',
center:'title',
right:'month,agendaweek,agendaDay' ,//得到你正在寻找的三个按钮标签,类似于演示
},
defaultView:'agendaWeek'//默认视图是agendaWeek
}); b
$ b >这里是它的jsfiddle。
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.
解决方案 $('#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.
这篇关于如何在Meteor中设置fullCalendar的defaultView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!