I use api google to get the event list from google on my project. My code is
this.getEvents = function(startDate, maxDate) {
gapi.client.load('calendar', 'v3', function() {
var request = gapi.client.calendar.events.list({
'calendarId': 'primary',
'timeMin': (new Date(startDate)).toISOString(),
'timeMax': (new Date(maxDate)).toISOString(),
'showDeleted': false,
'singleEvents': true,
'orderBy': 'startTime',
})
request.execute(function(response) {
if (!response.error) {
deferred.resolve(response.items);
} else {
deferred.reject('error');
}
});
})
return deferred.promise;
}
When I load for the first time, the event is loaded, but when I add the edit delete and call back funtion getevents, the events do not change until I reload the page. how can i fix it
Try this SO post answer .
So from the post, the user has the function RefreshCalendar()
. Try to integrate it in your code see the code below.
Call RefreshCalendar()
function on INSERT/UPDATE/DELETE event
function RefreshCalendar() {
ClearEvents();
$('#calendar').fullCalendar('refetchEvents');
}
function ClearEvents() {
$('#calendar').fullCalendar('removeEvents');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.