Sorikairo February 2016

FullCalendar removing only one event

My question is why this code doesn't remove a single event, but all at once, whereas the firing event is the good (so is the id).

Attaching click event on the icon when rendering the event :

   eventRender: function(event, element) {
 //console.log(event);
 if (event.type != "itineraire")
    element.find('.fc-title').append('<span class="removeEvent fa fa-trash pull-right"></span>');
      element.find(".fa-trash").click(function() {
        app.removeEvent(event._id);
      });
  },

The app.removeEvent(id) function:

removeEvent(id){
  console.log("we remove id " + id);
  $('#calendarContainer').fullCalendar('removeEvents',id);
}

Answers


Chintan Mirani February 2016

Try this.

removeEvent(id){
    console.log("we remove id " + id);
    $('#calendarContainer').fullCalendar( 'removeEvents', function(event) {
        return (event._id == id);
    });
}

This works for me.

Post Status

Asked in February 2016
Viewed 3,752 times
Voted 11
Answered 1 times

Search




Leave an answer