How to delete an event on FullCalendar?

Sof picture Sof · Apr 4, 2017 · Viewed 8.5k times · Source

I am trying to delete an event when it is being clicked.

This is what I have and I have no idea

        eventClick: function(calEvent, jsEvent, view) {

            alert('Event: ' + calEvent.title);
            alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
            alert('View: ' + view.name);
            alert('This needs to be deleted');

        // change the border color just for fun
        $(this).css('border-color', 'red');
        $('#calendar').fullCalendar(
            'removeEvents'
            [this] );

    },

The solution is actually here: https://fullcalendar.io/docs/event_data/removeEvents/ but I still cant follow. Please Help!

Answer

Pavlo Zhukov picture Pavlo Zhukov · Apr 4, 2017

In my code I delete event in fullcalendar in that way

$('#calendar').fullCalendar('removeEvents' , function(ev){  
    return (ev._id == calEvent._id);
})