Am working in fullcalandar jquery plugin,but now i stuck with refetching calendar. I have two event sources , and i have made custom refresh button on calendar headar. I want to do refetch events only from second event source whenever user hits refresh button.
Is there any way to pass paramater in fullcalendar refetchEvents and do refetch from single event source.
events: function(start, end, timezone,callback) {
$.ajax({
url: //FIRST EVENT SOURCE
dataType: 'json',
success: function(response) {
//attaching the response to the calendar
}
$.ajax({
url: // SECOND EVENT SOURCE
dataType: 'json',
success: function(response) {
//attaching response to calendar
}
});
}
Whenever user clicks on custom Refresh button , am doing $("#calendar").fullcalendar('refetchEvents');
-- this will refetch whole calendar (first + second event source)
What i expect to do is , i want to do refetch only for second event source.
EDIT: version 2.8.0 was released today and it supports fetching a single event source. My answer below is for older versions.
Am I correct that you don't want to refresh the first source, but you still need to keep the events from the first source on the screen? Then just leave them in a temporary cache. Then, use a global var to check that the user clicked Refresh.
var g_FirstSourceEventsCache = null;
var g_IsRefreshClicked = false;
events: function(start, end, timezone,callback) {
if (g_IsRefreshClicked) {
//do not reload from server, load from cache
callback(g_FirstSourceEventsCache);
g_IsRefreshClicked = false;
} else {
$.ajax({
url: //FIRST EVENT SOURCE
dataType: 'json',
success: function(response) {
//attaching the response to the calendar
//save to cache
g_FirstSourceEventsCache = myFirstSourceEventsThatIPassedToCallback;
}
}
//second source is always refreshed
$.ajax({
url: // SECOND EVENT SOURCE
dataType: 'json',
success: function(response) {
//attaching response to calendar
}
});
}