Avoid flickering of calendar view when refetching all events (#3405)
This commit is contained in:
parent
8627b72357
commit
c4a228ab99
2 changed files with 13 additions and 8 deletions
|
@ -3105,6 +3105,9 @@ function rcube_calendar_ui(settings)
|
|||
}
|
||||
}
|
||||
|
||||
// remove temp events
|
||||
fc.fullCalendar('removeEvents', function(e){ return e.temp; });
|
||||
|
||||
if (source && (p.refetch || (p.update && !source.active))) {
|
||||
// activate event source if new event was added to an invisible calendar
|
||||
if (this.quickview_active) {
|
||||
|
@ -3115,7 +3118,7 @@ function rcube_calendar_ui(settings)
|
|||
return false;
|
||||
}
|
||||
});
|
||||
fc.fullCalendar('refetchEvents', source);
|
||||
fc.fullCalendar('refetchEvents', source, true);
|
||||
}
|
||||
else if (!source.active) {
|
||||
source.active = true;
|
||||
|
@ -3123,7 +3126,7 @@ function rcube_calendar_ui(settings)
|
|||
$('#rcmlical' + source.id + ' input').prop('checked', true);
|
||||
}
|
||||
else
|
||||
fc.fullCalendar('refetchEvents', source);
|
||||
fc.fullCalendar('refetchEvents', source, true);
|
||||
|
||||
fetch_counts();
|
||||
}
|
||||
|
@ -3147,12 +3150,9 @@ function rcube_calendar_ui(settings)
|
|||
}
|
||||
// refetch all calendars
|
||||
else if (p.refetch) {
|
||||
fc.fullCalendar('refetchEvents');
|
||||
fc.fullCalendar('refetchEvents', undefined, true);
|
||||
fetch_counts();
|
||||
}
|
||||
|
||||
// remove temp events
|
||||
fc.fullCalendar('removeEvents', function(e){ return e.temp; });
|
||||
};
|
||||
|
||||
// modify query parameters for refresh requests
|
||||
|
|
|
@ -259,6 +259,7 @@ function Calendar(element, options, eventSources) {
|
|||
var ignoreWindowResize = 0;
|
||||
var date = new Date();
|
||||
var events = [];
|
||||
var lazyRendering = false;
|
||||
var _dragElement;
|
||||
|
||||
|
||||
|
@ -509,8 +510,8 @@ function Calendar(element, options, eventSources) {
|
|||
// TODO: going forward, most of this stuff should be directly handled by the view
|
||||
|
||||
|
||||
function refetchEvents(source) { // can be called as an API method
|
||||
clearEvents();
|
||||
function refetchEvents(source, lazy) { // can be called as an API method
|
||||
lazyRendering = lazy || false;
|
||||
fetchAndRenderEvents(source);
|
||||
}
|
||||
|
||||
|
@ -556,6 +557,10 @@ function Calendar(element, options, eventSources) {
|
|||
|
||||
// called when event data arrives
|
||||
function reportEvents(_events) {
|
||||
if (lazyRendering) {
|
||||
clearEvents();
|
||||
lazyRendering = false;
|
||||
}
|
||||
events = _events;
|
||||
renderEvents();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue