我已经实现了fullcalendar,除了两个问题外,它运行良好(我将在另一个问题中提出第二个问题)。
我不能添加图像,因为我没有声誉!为了解释我的意思,我有一个活动,从7月3日上午10点到7月5日上午10点整。按月份查看时,它只显示在7月3日,而不跨越4日或5日。
这是我的实现代码;
$('#calendar').fullCalendar({
events:function(start, end, callback) {
$.ajax({
type: "POST",
url: 'webservices/wsEvents.asmx/GetEventsBetweenDates',
contentType: "application/json",
dataType: "json",
data: formatCalendarDates(start, end),
success: function (doc) {
var events = [];
$.each(doc.d, function() {
var duration = GetDuration($(this).attr('StartTime'), $(this).attr('EndTime'), true);
var allday = moment.duration(moment($(this).attr('EndTime'))-moment($(this).attr('StartTime'))).days() >=1 ? true : false;
// duration.toLowerCase().indexOf("day") >= 0 ? true : false;
events.push({
title: replaceCharacter($(this).attr('Title'), "/u0027", "'"),
start: $(this).attr('StartTime'),
id: $(this).attr('ID'),
description: replaceCharacter($(this).attr('Description'),"/u0027","'"),
allDay: allday,
locationID: $(this).attr('Location'),
location: replaceCharacter($(this).attr('LocationName'), "/u0027", "'"),
duration: duration
});
});
callback(events);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
// debugger;
ShowError("Error: " + textStatus);
}
});
},
theme: true,
header: {
left: 'prevYear,prev,next,nextYear today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
buttonIcons:{
prevYear: "ui-icon ui-icon-triangle-1-w",
prev: "ui-icon ui-icon-carat-1-w",
next: "ui-icon ui-icon-carat-1-e",
nextYear: "ui-icon ui-icon-triangle-1-e"
},
editable: false,
allDaySlot: true,
allDayDefault: false,
firstDay: 1,
timeFormat: {
month: "H:mm",
week: "",
day: ""
},
weekNumbers: true,
weekNumberCalculation: "iso",
weekMode: "liquid",
weekNumberTitle: "Wk",
defaultView: "month",
firstHour: 0,
buttonText: {
today: 'today',
month: 'month',
week: 'week',
day: 'day'
},
columnFormat: {
month: 'ddd', // Mon
week: 'ddd d/M', // Mon 9/7
day: 'dddd d/M' // Monday 9/7
},
eventClick: function (date, allDay, jsEvent, view) {
DisplaySingleEvent(date, false)
},
eventMouseover: function (event, jsEvent, view) {
$(this).css('cursor', 'pointer')
},
eventMouseout: function (date, allDay, jsEvent, view) {
$(this).css('cursor', 'default')
},
eventRender: function (event, element) {
},
viewDisplay: function (view) {
}
});
有人能从我的代码中看到我做错了什么吗?
感谢
特里。
经过教育的猜测:在事件数组中指定end
。您给出了duration
,但根据规范,这不是标准属性。