title: FullCalendar clear selected days
body: <p>I want to create a calendar that lets users select multiple days then create an event based on the selected days and also clear the selected days.</p>
  <p>So far, I am able to select multiple days (Thanks to <a href="https://stackoverflow.com/a/29212500/9360197">code from DanielST</a>) and get the selected days. Now I want to implement a 'Refresh' button to clear currently selected days. However, I was not able to implement it yet. I have tried ('refetchEvents') and ('rerenderEvents'), but it is not working.</p>
  <p>How do I achieve it?</p>
  <p>JS (<a href="http://jsfiddle.net/cm7yLj9q/" rel="nofollow noreferrer">JSFiddle</a>):</p>
  <pre><code>window.selectedDates = [];
  window.batchEvents = [];
  window.batchIDs = [];
  
  $('#calendar').fullCalendar({
    defaultDate: '2014-11-10',
    defaultView: 'month',
    events: [{
      start: '2014-11-12T13:00:00',
      end: '2014-11-12T16:00:00',
    }, ],
    selectable: true,
    select: function(start, end, jsEvent, view) {
      let startDate = start.format();
      console.log('start: ' + startDate);
      let newID = randomIntFromInterval(0,100);
      window.batchIDs.push({id:newID});
      let newEventSource = {
          id: newID,
        start: start,
        end: end,
        rendering: 'background',
        block: true,
      };
      window.batchEvents.push(newEventSource);
      $(&quot;#calendar&quot;).fullCalendar('addEventSource', [newEventSource]);
      $(&quot;#calendar&quot;).fullCalendar(&quot;unselect&quot;);
      window.selectedDates.push(startDate);
    },
    selectOverlap: function(event) {
      return !event.block;
    },
    unselectAuto: true,
    unselect: function(jsEvent,view) {
      //console.log(jsEvent);
    },
    customButtons: {
      refreshbutton: {
        text: 'refresh',
        click: function () {
          console.log('refresh clicked');
          console.log(window.batchEvents);        
          console.log(window.batchIDs);
  
          $(&quot;#calendar&quot;).fullCalendar('removeEventSources',window.batchEvents);
          window.selectedDates = [];
          window.batchIds = [];
        }
      },
      selectedButton: {
        text: 'Check Days',
        click: function () {
          console.log(window.selectedDates);
          console.log(window.batchEvents);
        }
      }
    },
    header: {
      left: 'prev,next today refreshbutton selectedButton',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    }
  });
  function randomIntFromInterval(min, max) { // min and max included 
    return Math.floor(Math.random() * (max - min + 1) + min)
  }
  </code></pre>