当我用新事件更新"events"对象并调用calander.fullCalendar("retchEvents")时,日历不会刷新。
示例:
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');
尽管我预计"event2"会出现,但仍然只显示"event1"。
http://jsfiddle.net/u1fjfbzw/
让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
}