javascript - FullCalendar removing only one event -
my question why code doesn't remove single event, @ once, whereas firing event (so id).
attaching click event on icon when rendering 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); }
try this.
removeevent(id){ console.log("we remove id " + id); $('#calendarcontainer').fullcalendar( 'removeevents', function(event) { return (event._id == id); }); }
this works me.
Comments
Post a Comment