除了我遇到的一个问题之外,FullCalendar运行得很好。在monthview模式下加载日历的monthview div似乎显示了加载的重复假日。当我添加一个事件,然后调用我的日历绑定函数时,就会发生这种情况,该函数基本上运行以下代码。
其他人也有类似的问题吗?看起来'removeEvents‘函数对来自内部数据库的数据馈送工作正常,但似乎留下了谷歌日期。当调用addEventSource时,它会再次添加相同的事件。
var googleUkHolidaysFeed = {
url: 'http://www.google.com/calendar/feeds/uk__en%40holiday.calendar.google.com/public/basic',
cache: true,
color: "green"
};
$.getJSON(url, {}, function (data) {
$('#dayview').fullCalendar('removeEvents');
$('#dayview').fullCalendar('addEventSource', data);
if ($("#monthview")[0]) {
$('#monthview').fullCalendar('removeEvents');
$('#monthview').fullCalendar('addEventSource', data);
$('#monthview').fullCalendar('addEventSource', googleUkHolidaysFeed);
}
});
发布于 2011-11-10 00:26:13
我自己解决了这个问题。必须在“removeEventSource”之后调用“removeEvents”,如下所示:
('data‘是应用程序提供的事件的json数组,'googleCalendarUkHolidayFeed’是来自谷歌的url提要)。
var googleCalendarUkHolidayFeed = {
url: "http://www.google.com/calendar/feeds/bla..."
}
$('#dayview').fullCalendar('removeEvents');
$('#dayview').fullCalendar('addEventSource', data);
if ($("#monthview")[0]) {
// remove events and re-add event source to reflect search/non-search
$('#monthview').fullCalendar('removeEvents');
$('#monthview').fullCalendar('removeEventSource', googleCalendarUkHolidayFeed);
$('#monthview').fullCalendar('removeEventSource', data);
$('#monthview').fullCalendar('addEventSource', googleCalendarUkHolidayFeed);
$('#monthview').fullCalendar('addEventSource', data);
}
https://stackoverflow.com/questions/7997889
复制相似问题