我无法将日期附加到calEvent.Url。同样的事情在dayClick中工作正常,但是当我尝试将相同的代码附加到calEvent.Url时,我的事件从日历中消失。我在Global.asax中设置了一个路由来处理网址并指导他们正确的操作。这在dayClick上工作正常,但不是事件点击。非常感谢任何帮助!
<script type="text/javascript">
$(document).ready(function () {
$('#calendar').fullCalendar({
theme: false,
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay, agendaWeek, month'
},
defaultView: 'month',
editable: false,
allDay: true,
eventClick: function (calEvent, jsEvent, view) {
window.location.href = 'BrowseCal/' +
date.getDate() + '-' +
(date.getMonth() + 1) + '-' + // months are zero based
date.getFullYear();
// change the border color just for fun
$(this).css('border-color', 'red');
},
dayClick: function (date, allDay, jsEvent, view) {
if (allDay) {
window.location.href = 'BrowseCal/' +
date.getDate() + '-' +
(date.getMonth() + 1) + '-' + // months are zero based
date.getFullYear();
}
},
events: function (start, end, callback, date) {
// do some asynchronous ajax
contentType: "application/json; charset=utf-8",
$.getJSON("/WhatsOn/CalendarData/",
function (result, date) {
if (result != null) {
for (i in result) {
var calEvent = result[i];
calEvent.start = new Date(parseInt(calEvent.start.replace("/Date(", "").replace(")/", ""), 10));
calEvent.end = new Date(parseInt(calEvent.end.replace("/Date(", "").replace(")/", ""), 10));
**calEvent.Url = 'BrowseCal/' + date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullTear();**
}
}
var calevents = result;
// then, pass the CalEvent array to the callback
callback(calevents);
});
}
});
});
答案 0 :(得分:0)
好吧,似乎没有定义日期,您已使用 * 标记了代码。你确定你不想要start.getDate(),start.getMonth()等,无论是那个还是end.getDate()等等。