当我使用新事件更新'events'对象并调用calander.fullCalendar('refetchEvents')时,日历不会刷新。
示例:
events = [ { title : 'event1', start : '2015-11-01' } ];
calendar = jQuery("#calendar").fullCalendar({ events: events });
events = [ { title : 'event2', start : '2015-11-02' } ];
console.log(events);
calendar.fullCalendar('refetchEvents');
仍然只显示'event1',即使我希望'event2'出现。
答案 0 :(得分:3)
将event1和event2同时显示的简单方法是再次将事件数组添加为事件源。 http://jsfiddle.net/u1fjfbzw/1/
events = [ { title : 'event1', start : '2015-11-01' } ];
calendar = jQuery("#calendar").fullCalendar({ events: events });
events = [ { title : 'event2', start : '2015-11-02' } ];
/* This will make it show up */
calendar.fullCalendar('addEventSource', events);
calendar.fullCalendar('refetchEvents');
代码中的'events'数组与fullCalendar的内部事件是分开的。来自fullcalendar.js 2.4.0:
else if (typeof sourceInput === 'object') {
source = $.extend({}, sourceInput); // shallow copy
}