how to update an event in fullCalendar?

安稳与你 提交于 2019-12-03 08:28:48

You aren't calling the correct fullCalendar method to render the new events.

This will not work because it is only meant to render the events the first time around:

   $("#demo-calendar").fullCalendar('renderEvents', JSON);

Instead you need to remove the events on the calendar and refresh them:

   $("#demo-calendar").fullCalendar('removeEvents'); 
   $("#demo-calendar").fullCalendar('addEventSource', JSON); 

Check the Fiddle: http://jsfiddle.net/shaunp/u8Ksw/29/

NOTE that there is a fullCalendar method called refetchEvents, but that it does NOT work on an array of events such as what you have created, so you must manually take the events off and re-add the event source again.

Rohit Borude

You need to add the following lines:

$("#demo-calendar").fullCalendar('removeEvents'); 
$("#demo-calendar").fullCalendar('addEventSource', JSON, true); 

When adding new events to the calendar they can disappear when switching months. To solve this add stick: true to the event object being added to the scope.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!