[英]Show days and events only of the current month in the fullcalendar.io
在fullcalendar.io的“月”视图中,我只想显示当前月以及当前月事件。 但是,当前显示的是从当前日期算起的一个月。
例如:如果今天是2016年20月3日...
-全日历显示: 从:2016-20-03至:2016-19-04
-我要显示的内容: 从2016-01-03至:2016-31-03
在阅读了文档并四处查找之后,我找不到任何变量或设置了fullcalendar来实现这一目标,所以我不得不修改fullcalendar.js
有人已经这样做了吗?
视图
$('#' + engineerId).fullCalendar({
header: false,
views: {
plainMonth: {
type: 'basic',
duration: { days: 31 },
buttonText: 'Month'
},
plainWeek: {
type: 'basic',
duration: { days: 7 },
buttonText: 'Week'
}
},
firstDay: 1,
dayNamesShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
defaultView: 'plainWeek',
theme: true,
viewRender: function (view, element) {
$('#CalendarViewObject').val(view.name);
viewName = view.name;
},
aspectRatio: ratio,
editable: true,
eventLimit: false, // allow "more" link when too many events
events: {
startEditable: false,
durationEditable: false,
url: window.location.href.toString().split(window.location.host)[1] + '/GetEmployeeEvents',
type: 'POST',
data: function () { // a function that returns an object
$("[id^=qtip-]").empty();
$("[id^=qtip-]").remove();
return {
serviceAreaId: serviceAreaId,
employeeId: engineerId,
calendarViewObject: $('#CalendarViewObject').val()
};
},
error: function () {
alert('there was an error while fetching events!');
}
},...
调节器
public JsonResult GetEmployeeEvents(DateTime start, DateTime end, string queueName, string employeeId, string calendarViewObject)
“开始”和“结束”日期由fullcalendar.io设置,这些日期是我要更改的日期。
预先非常感谢Alvykun
在完整日历文档中进行了更多研究之后,我最终设置了以下内容:
$(\'.calendarClass\').fullCalendar(\'gotoDate\',new Date(y, m, 1));
这样就成功了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.