1
我希望能夠基於添加和刪除eventSources來過濾事件。我找不到一個很好的例子。添加/刪除eventSources FullCalendar
.fullCalendar('addEventSource', source)
.fullCalendar('removeEventSource', source)
我想要複選框來切換這些功能的執行。我似乎無法得到功能雖然工作。
$("#target").click(function() {
$('#calendar').fullCalendar('removeEventSource', 'Event1');
});
這裏是我的全碼:
$('#calendar').fullCalendar({
header: {
left: 'title',
center: 'prev,next',
right: 'month,agendaWeek,agendaDay,today'
},
eventLimit: {
'agenda': 4, // adjust to 6 only for agendaWeek/agendaDay
'default': true // give the default value to other views
},
eventSources: [
{
title: 'Event1',
url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic"
},
{
url: 'https://www.google.com/calendar/feeds/vineyardcincinnati.com_o6jncckm5ka55fpragnbp4mk9c%40group.calendar.google.com/public/basic'
},
{
url: "https://www.google.com/calendar/feeds/ht3jlfaac5lfd6263ulfh4tql8%40group.calendar.google.com/public/basic"
}
],
eventClick: function(event) {
// opens events in a popup window
window.open(event.url, 'gcalevent', 'width=700,height=600');
return false;
},
loading: function(bool) {
if (bool) {
$('#loading').show();
}else{
$('#loading').hide();
}
}
});
「源參數相當靈活。您可以提供一個事件源的Array/URL/Function,或者您可以指定完整的事件源對象。「標題不是其中之一 – 2014-11-06 11:00:19
感謝,由於某種原因,似乎也不工作$('## ')。fullCalendar('removeEventSource',eventSources [0]); – byrdr 2014-11-06 14:24:29
URL適用於我:$(「#target」).click(function(){ alert(「Handler for .click()called。」) ); $('#calendar')。fullCalendar('removeEventSource','https://www.google.com/calendar/feeds/vineyardcincinnati.com_o6jncckm5ka55fpragnbp4mk9c%40group.calendar.google.com/public/basic'); }); – byrdr 2014-11-06 14:49:41