[英]google calendar not refresh event
I use api google to get the event list from google on my project. 我使用api google从我的项目中的google获取事件列表。 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. 首次加载时,事件将被加载,但是当我添加edit delete和回调函数getevents时,事件将不会更改,直到我重新加载页面为止。 how can i fix it
我该如何解决
Try this SO post answer . 试试这个帖子 。
So from the post, the user has the function RefreshCalendar()
. 因此,从帖子中,用户可以使用
RefreshCalendar()
函数。 Try to integrate it in your code see the code below. 尝试将其集成到您的代码中,请参见下面的代码。
Call RefreshCalendar()
function on INSERT/UPDATE/DELETE event 在INSERT / UPDATE / DELETE事件上调用
RefreshCalendar()
函数
function RefreshCalendar() {
ClearEvents();
$('#calendar').fullCalendar('refetchEvents');
}
function ClearEvents() {
$('#calendar').fullCalendar('removeEvents');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.