简体   繁体   中英

FullCalendar is removing all recurring events instead of event that matches filter

I am trying to remove one event from a recurring event. I am using the ice_cube gem to assist with recurring events. All of the functionality works for creating and editing recurring events.

If a user wants to delete one event of a recurring event I use the following:

  eventClick: (event, jsEvent, view) ->
    $('#calendar').fullCalendar('removeEvents', event._id);
    return

Where event._id is an unique id fullCalendar creates for each event on the calendar. However, instead of removing the one event of the recurring events that is passes it removes all of the events.

What am I doing wrong and how can I get fullCalendar to remove only one event of a sequence of events?

FullCalendar event doc page says that recurring events have the same ID.

removeEvents doc page says that you can provide a filtering function if you want to delete a single event object.

eventClick: function (calEvent, jsEvent, view) {
    $('#calendar').fullCalendar('removeEvents', function (eventCandidate) {
        return calEvent === eventCandidate;
    });
}

UPD : if the filtering function doesn't work, custom rendering hook might help.

You would probably have to set a custom property on the event (or remember its ID and date somewhere) and then exclude such an event during the render.

eventClick: function (calEvent, jsEvent, view) {
    calEvent.excludedByUser = true;
},
eventRender: function(calEvent, element) {
    if (calEvent.excludedByUser) {
       return false;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM