我正在使用带有2个JSON提要的fullCalendar作为事件源。单击事件时,我使用eventClick打开模式窗口。然而,我只需要第一个事件源(json-events.php)的模式窗口。我希望第二个源(json-paidstaff.php)的所有事件都是没有eventClick函数的静态框。有没有办法只为一个源指定eventClick?
我的js当前
$('#calendar').fullCalendar({
editable: false,
timeFormat: 'H(:mm)', // uppercase H for 24-hour clock
eventSources: [
// your event source
{
url: 'json-events.php?uid=$bbuserinfo[userid]'
},
// any other sources...
{
url: 'json-paidstaff.php?uid=$bbuserinfo[userid]',
color: 'black', // a non-ajax option
textColor: 'white' // a non-ajax option
}
],
eventRender: function (event, element) {
element.find('.fc-event-title').append("<br/>" + event.namescreds);
},
loading: function (bool) {
if (bool) $.blockUI();
else $.unblockUI();
},
eventClick: function (calEvent, jsEvent, view) {
$.blockUI();
Boxy.load('ajax.php?uid=$bbuserinfo[userid]&id=' + calEvent.id, {
modal: true,
closeable: true,
afterShow: ($.unblockUI())
});
}
});
如文档中所示,您可以拥有自己的非标准字段,我们可以在其中存储任意信息,在我们的情况下,我们可以存储事件所属的位置。
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: [{
"id": 1,
"title": "Hello World",
"start": "Wed, 15 Jan 2014 09:00:00",
"end": "Wed, 15 Jan 2014 10:00:00",
"belongsto" : "list 1"
}, {
"id": 2,
"title": "Good Afternoon",
"start": "Wed, 23 Jan 2014 13:00:00",
"end": "Wed, 23 Jan 2014 17:00:00",
"belongsto" : "list 2"
}],
eventClick: function(calEvent, jsEvent, view) {
alert(calEvent.belongsto);
if(calEvent.belongsto === "list 1") {
//do something.
}
}
});
DEMO