事件在month,basicWeek和basicDay视图中正确呈现;但是,allDay设置为false(具有特定时间)的事件不会出现在agendaweek和agendaDay视图中。我已经检查过JSON并确认allDay被正确设置为布尔值。 alldayDefault设置为false。我甚至为agendaWeek和agendaDay视图定义了特定的时间间隔。我已经用Google搜索了问题,目前的解决方案往往源于对allDayDefault或allDaySlot参数的处理。对我来说似乎没有问题。非常感谢任何见解。
<script>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $("#calendar").fullCalendar({
defaultView: "month",
weekends: true,
minTime: 6,
maxTime: 23,
height: 620,
allDayDefault: false,
header: {
left: "prev,next today",
center: "title",
right: "month,agendaWeek,agendaDay"
},
editable: true,
events: "../getCalendarEvents.php",
eventLimit: true,
views: {
agendaWeek: {
minTime: 6,
maxTime: 23
},
agendaDay: {
minTime: 6,
maxTime: 23
}
},
// Convert the allDay from string to boolean
eventRender: function(event, element, view) {
if (event.allDay === 'true')
{
event.allDay = true;
} else
{
event.allDay = false;
}
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay)
{
var start = moment(start).format("MM/DD/YYYY");
var end = moment(end).format("MM/DD/YYYY");
window.location = 'calendar_addEvent_template.php?start=' + start + '&end=' + end;
calendar.fullCalendar('unselect');
},
eventDrop: function(event, delta)
{
var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: '../eventUpdate.php',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json)
{
alert("Updated Successfully");
}
});
},
eventResize: function(event) {
var start = $.fullCalendar.formatDate(event.start, "yyyy-MM-dd HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: 'eventUpdate.php',
data: 'title='+ event.title+'&start='+ start +'&end='+ end +'&id='+ event.id ,
type: "POST",
success: function(json)
{
alert("Updated Successfully");
}
});
}
});
});
答案 0 :(得分:1)
我一遍又一遍地教自己同样的课程。阅读*(手册!
我更改了mintime和maxtime的视图特定选项
这
views: {
week: {
minTime: "6”,
maxTime: "23"
},
day: {
minTime: "6",
maxTime: "23"
}
},
要
views: {
week: {
minTime: "06:00:00",
maxTime: "23:00:00"
},
day: {
minTime: "06:00:00",
maxTime: "23:00:00"
}
},
AND VIOLA!我希望能节省一些时间。
答案 1 :(得分:0)
您是否以此格式加载活动?我知道你提到过你做了,但要仔细检查它,因为你的代码似乎可以找到一些添加的事件,至少在jFiddle上(注意一定要先使用这些确切的引用,因为即使更改jQuery版本似乎导致奇怪的错误):
<script src="http://www.arshaw.com/js/fullcalendar-1.5.3/fullcalendar/fullcalendar.min.js"></script>
<link href="http://arshaw.com/js/fullcalendar-1.5.3/fullcalendar/fullcalendar.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>