Fullcalendar remoteEventSource deletes all sources

I have fullcalendar with some buttons that add and remove json sources. Script perfectly adds sources, but when I try to delete one source, it deletes all sources. There is something I missed something, maybe someone can help me.

$('.mycheckboxes').click(function() {

    // retrieve calendar ID from clicked checkbox
    var cal = $(this).attr('id');

    // define a json event source
    var src = {
        url: 'calendarJSON.php', 
        type: 'GET', 
        data: { calendar_id: cal }
    }


    if( $(this).is(':checked')) {
        $('#calendar').fullCalendar( 'addEventSource', src );
    } else {
        $('#calendar').fullCalendar('removeEventSource', src );

    }
});

Why does he delete all event sources? How should I specify the one I want to delete? Thank.

+3
source share
2 answers

As described in a (very good) document , just pass the URL of your event source.

So try this code:

$('#calendar').fullCalendar('removeEventSource', 'calendarJSON.php' );

Here you can find a working example http://jsfiddle.net/domi27/bQXYp/1/

+2
source

domi27, fullcalendar URL. , . . .

: - URL, fullcalendar !

.

// define a json event source
var src = {
    url: 'calendarJSON.php?dummy=' + cal, 
    type: 'GET', 
    data: { calendar_id: cal }
}
+1

All Articles