Issue 798: removeEventSource not work with google calendar feeds
Status:  Done
Owner: ----
Closed:  Feb 2011
Reported by frankis...@hotmail.com, Jan 17, 2011
To remove a event source fullCalendar use the source variable.
The "removeEventSource" function not works because the following comparison fails: 
sources = $.grep(sources, function(src) {
			return src != source;
		});
This could be solved using a hash function like sha256:
sources = $.grep(sources, function(src) {
			return $.sha156(src) != $.sha256(source);
		});

Also once solved, still fails because remove all the sources that use the function defined in gcal.js because is the same code so gives the same sha256 value.
I've implemented a solution: Added a parameter in the function of gcal.js file so the function returns the feedUrl if the value is true, otherwise do the normal behaviour. So on removeEventSource call to the source function passing true to use the feedUrl as a valid UUID.


patch.zip
29.1 KB   Download
Feb 13, 2011
Project Member #1 adamrs...@gmail.com
the purest solution is just to hold on to the gcal feed that is created, and make sure to pass the same feed back in. like this...

    var gcalFeed = $.fullCalendar.gcalFeed("..url..");
    $('#calendar').fullCalendar({
        eventSources: [
            gcalFeed
        ]
    });

then you can do this when you want to remove it...

    $('#calendar').fullCalendar('removeEventSource', gcalFeed);

you just need to hold on to the reference.

i'd rather not rely upon this $.sha156 function

fullcalendar 1.5 will be much better on this front. it basically compares the feed url's, so it is much less error-prone
Status: Done