Question

I am using Fullcalendar latest, jquery 1.10, and qtip 2.

I simply add a qtip to element in the in the eventRender callback that contains a button:

element.qtip({
    content: {
        title: { text: event.title },
        text: '<button type="button" onclick="removeEvent(' + event.id + ')">Delete</button>'
    },
    show: {
        event: 'click',
        solo: true
    },
    hide: {
        event: 'unfocus click'
    }
});

On the select callback I have the following:

$('#calendar').fullCalendar('renderEvent',
    {
        title: 'Available',
        start: start,
        end: end,
        allDay: allDay
    },
    true //make the event stick
);

And then here is the remove Event Code:

function removeEvent(eventId, userId)
{    
    //Delete the event
    $('#calendar').fullCalendar('removeEvents', eventId);
}

Under the eventDestroy callback I have:

element.qtip('destroy');

My issue is that the eventDestroy never seems to get called when I call the callback.

I set up a jsfiddle example here: http://jsfiddle.net/MusicMonkey5555/Zs657/1/

It differs a bit but simply click a calendar item it will prompt if you want to delete it and then it should pop up an alert, but never does.

Anyone have an idea why it isn't working?

Était-ce utile?

La solution

According to full calendar documentation, eventDestroy is only available starting with version 1.6.3 and you are using 1.5.

See : http://arshaw.com/fullcalendar/docs/event_rendering/eventDestroy/

Edit : I actually just tested this by modifying your fiddle, and it looks like the callback is still not working. It is triggered when you resize the window however (I assume the lib is re-rendering the events and therefore destroying the DOM).

Looking a bit at the code, it looks like the eventDestroy callback is only called when the fullcalendar view is destroyed. Never when you remove individual events. So that would be a current limitation of this lib.

In your case, it will be easier to directly call your destroy callback from your removeEvent method, since you can't rely on the lib for that.

Autres conseils

For those who may have this problem in the future: "Event destroy callback on event removal" is fixed in the 2.1.0 release.

http://github.com/arshaw/fullcalendar/releases/tag/v2.1.0

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top