Fullcalendar V4 - clear all events

前端 未结 4 1306
清歌不尽
清歌不尽 2020-12-21 20:55

I\'m loading dynamic events from a JSON source, but each time I click a different room, I want to clear all the events prior to fetching the new ones

I have attempte

4条回答
  •  甜味超标
    2020-12-21 21:15

    You can call removeAllEvents function to delete all event without refreshing the whole page :

    document.addEventListener('DOMContentLoaded', function () {
         var calendarEl = document.getElementById('calendar');
    
         var calendar = new FullCalendar.Calendar(calendarEl, {/*OPTIONS*/});
    
         $('#button').on('click', function () {
              calendar.removeAllEvents();
         });
    });
    

提交回复
热议问题