Better/more hiding of calendar redrawing when changing views

This commit is contained in:
nathangray 2016-06-22 09:56:16 -06:00
parent 184a68bb73
commit 0962d7fb27
2 changed files with 40 additions and 10 deletions

View File

@ -2023,6 +2023,16 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
*/
if(grid)
{
// Show loading div to hide redrawing
egw.loading_prompt(
this.appname,true,egw.lang('please wait...'),
typeof framework !== 'undefined' ? framework.applications.calendar.tab.contentDiv : false,
egwIsMobile()?'horizental':'spinner'
);
var loading = false;
var value = [];
state.state.first = view.start_date(state.state).toJSON();
// We'll modify this one, so it needs to be a new object
@ -2096,11 +2106,11 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
owner: state.state.owner[i]
});
}
this._need_data(day_value,state.state);
loading = this._need_data(day_value,state.state);
}
else
{
this._need_data(value,state.state);
loading = this._need_data(value,state.state);
}
var row_index = 0;
@ -2226,7 +2236,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
}
}
var value = [{start_date: state.state.first, end_date: state.state.last}];
this._need_data(value,state.state);
loading = this._need_data(value,state.state);
}
// Include first & last dates in state, mostly for server side processing
if(state.state.first && state.state.first.toJSON) state.state.first = state.state.first.toJSON();
@ -2270,13 +2280,6 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
},this,et2_calendar_timegrid);
}
// Trigger resize to get correct sizes, as they may have sized while
// hidden
for(var i = 0; i < view.etemplates.length; i++)
{
view.etemplates[i].resize();
}
// List view (nextmatch) has slightly different fields
if(state.state.view === 'listview')
{
@ -2415,6 +2418,23 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
}
egw.set_preference('calendar','saved_states', save);
// Trigger resize to get correct sizes, as they may have sized while
// hidden
for(var i = 0; i < view.etemplates.length; i++)
{
view.etemplates[i].resize();
}
// If we need to fetch data from the server, it will hide the loader
// when done but if everything is in the cache, hide from here.
if(!loading)
{
window.setTimeout(jQuery.proxy(function() {
egw.loading_prompt(this.appname,false);
},this),500);
}
return;
}
// old calendar state handling on server-side (incl. switching to and from listview)
@ -2651,6 +2671,8 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
*
* @param {Object} value
* @param {Object} state
*
* @return {boolean} Data was requested
*/
_need_data: function(value, state)
{
@ -2728,6 +2750,8 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
this.sidebox_et2 ? null : this.et2.getInstanceManager()
);
}
return need_data;
},
/**

View File

@ -767,6 +767,10 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
* We use a timeout to avoid doing it multiple times if redrawing or resizing.
*/
resizeTimes: function() {
// Hide resizing from user
this.loader.show();
// Wait a bit to see if anything else changes, then re-draw the times
if(this.resize_timer)
{
@ -824,6 +828,8 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
child.resize();
},this, et2_IResizeable);
}
this.loader.hide();
},
/**