我查看使用fullcalendar插件的地方。
以下是视图代码:
<div id="calendar" style="height: 90%; width: 100%; clear: both; display: inline-block;overflow-y:hidden ">
</div>
<script> //Calendar initialization
$(document).ready(function () {
$('#calendar').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek',
events:"/Calendar/GetEvents/",
firstDay: 1,
editable: true
});
});
但在另一个视图中我只需要显示今天的日期。喜欢这里的设计
如何在fullcalendar中执行此操作?
答案 0 :(得分:0)
您可以在单独的对象中设置日历设置,并使用功能重新创建FC视图。
var $fc = $("#calendar");
var options = { // Create an options object
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay,agendaWeek,month'
},
defaultView: 'agendaWeek',
events:"/Calendar/GetEvents/",
firstDay: 1,
editable: true
}
$fc.fullCalendar(options);
function recreateFC(/*arguments*/) { // This will destroy and recreate the calendar
if (/*your condition here*/) {
options.defaultView = 'agendaDay';
} else {
options.defaultView = 'agendaWeek';
}
}