Issue 2019: revertFunc() doesn't work as expected
Status:  Done
Owner: ----
Closed:  Jun 2014
Reported by wojtek.z...@gmail.com, Oct 16, 2013
After calling revertFunct() more than once from jQuery's event callback, revert effects stack

http://jsfiddle.net/pambuk/5yvNQ/1/

Steps to reproduce:
1. Move event with drag&drop
2. In the popup click 'No'
3. Repeat.

What happens is it works for the first time, but when calling revertFunc() again, it will revert events twice, after calling again, three times, and so on.

Attached screenshot shows 2 calls to revertFunc() (console log of eventsByID shows 3 times).
fullcalendar_revert_called_twice.png
12.5 KB   View   Download
Oct 27, 2013
#1 rpowers...@gmail.com
Make sure you call unbind on the event (or initialize the dialog event code once somewhere else), since a new click event listener is bound each time the eventDrop function is called.

This code fixes it:

    $('#prompt').show();
    var $cancel = $('#cancel-move');
    $cancel.unbind('click');
    $cancel.click(function () {
        revertFunc();
        $('#prompt').hide();
    });
Oct 28, 2013
#2 wojtek.z...@gmail.com
Perfect, works like a charm, thank you very much.
Jun 7, 2014
Project Member #3 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Reproducing
Labels: Type-Bug
Jun 11, 2014
Project Member #4 adamrs...@gmail.com
thx for the help rpowers. this is a user error. closing this bug
Status: Done