rerendering events in fullCalendar after Ajax database update

后端 未结 7 762
渐次进展
渐次进展 2020-12-08 01:13

I am trying to have fullCalendar reflect changes made to a database via AJAX. The problem is that it won\'t update the calendar on screen after a successful AJAX call.

7条回答
  •  盖世英雄少女心
    2020-12-08 01:46

    There are several ways. Some less elegant.

    1. If you are using FullCalendar to grab json events:

    $('#calendar').fullCalendar({ events: "json-events.php",    });
    

    Just do:

    $('#calendar').fullCalendar( 'refetchEvents' );
    

    If you want outside method to fetch events you could do. Not elegant but will work

    $('#calendar').fullCalendar( 'removeEventSource', source )
    $('#calendar').fullCalendar( 'addEventSource', source )
    

提交回复
热议问题