mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 23:19:04 +01:00
Some more performance improvements when scrolling through weeks:
- Fix typo causing unneeded time resize before redraw - Change daycol resize & event sizing, eliminating the need to resize all events when daycol changes size - Fix check for existing week by only checking day, not whole time - Better handling of scrolling through weeks for faster update
This commit is contained in:
parent
37f61b1f03
commit
5d5e45e1ad
@ -1900,6 +1900,13 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
|
||||
var grid = view.etemplates[0].widgetContainer.getWidgetById('view');
|
||||
|
||||
// Show the templates for the current view
|
||||
// Needs to be visible while updating so sizing works
|
||||
for(var i = 0; i < view.etemplates.length; i++)
|
||||
{
|
||||
$j(view.etemplates[i].DOMContainer).show();
|
||||
}
|
||||
|
||||
/*
|
||||
If the count is different, we need to have the correct number
|
||||
If the count is > 1, it's either because there are multiple date spans (weekN, month) and we need the correct span
|
||||
@ -2005,18 +2012,37 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
|
||||
// Swap DOM nodes
|
||||
var a = grid._children[0].getDOMNode().parentNode.parentNode;
|
||||
var a_scroll = $j('.calendar_calTimeGridScroll',a).scrollTop();
|
||||
var b = grid._children[1].getDOMNode().parentNode.parentNode;
|
||||
a.parentNode.insertBefore(a,b);
|
||||
|
||||
// Moving nodes changes scrolling, so set it back
|
||||
var a_scroll = $j('.calendar_calTimeGridScroll',a).scrollTop(a_scroll);
|
||||
}
|
||||
}
|
||||
else if (row_index > i)
|
||||
{
|
||||
// Swap DOM nodes
|
||||
var a = grid._children[row_index].getDOMNode().parentNode.parentNode;
|
||||
var a_scroll = $j('.calendar_calTimeGridScroll',a).scrollTop();
|
||||
var b = grid._children[i].getDOMNode().parentNode.parentNode;
|
||||
a.parentNode.insertBefore(a,b);
|
||||
grid._children.splice(i,0,widget);
|
||||
grid._children.splice(row_index+1,1);
|
||||
|
||||
// Simple scroll forward, put top on the bottom
|
||||
// This makes it faster if they scroll back next
|
||||
if(i==0 && row_index == 1)
|
||||
{
|
||||
$j(b).appendTo(b.parentNode);
|
||||
grid._children.push(grid._children.shift());
|
||||
}
|
||||
else
|
||||
{
|
||||
grid._children.splice(i,0,widget);
|
||||
grid._children.splice(row_index+1,1);
|
||||
a.parentNode.insertBefore(a,b);
|
||||
}
|
||||
|
||||
// Moving nodes changes scrolling, so set it back
|
||||
var a_scroll = $j('.calendar_calTimeGridScroll',a).scrollTop(a_scroll);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2045,12 +2071,17 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
widget.set_granularity(view.granularity(state.state));
|
||||
}
|
||||
if(widget.id == value[row_index].id &&
|
||||
widget.get_end_date().toJSON() == value[row_index].end_date
|
||||
widget.get_end_date().getUTCFullYear() == value[row_index].end_date.substring(0,4) &&
|
||||
widget.get_end_date().getUTCMonth()+1 == value[row_index].end_date.substring(5,7) &&
|
||||
widget.get_end_date().getUTCDate() == value[row_index].end_date.substring(8,10)
|
||||
)
|
||||
{
|
||||
// Do not need to re-set this row, but we do need to re-do
|
||||
// the times, as they may have changed
|
||||
widget.invalidate();
|
||||
widget.resizeTimes();
|
||||
|
||||
// Hide loader
|
||||
widget.loader.hide();
|
||||
row_index++;
|
||||
return;
|
||||
}
|
||||
@ -2091,11 +2122,6 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
if(state.state.first && state.state.first.toJSON) state.state.first = state.state.first.toJSON();
|
||||
if(state.state.last && state.state.last.toJSON) state.state.last = state.state.last.toJSON();
|
||||
|
||||
// Show the templates for the current view
|
||||
for(var i = 0; i < view.etemplates.length; i++)
|
||||
{
|
||||
$j(view.etemplates[i].DOMContainer).show();
|
||||
}
|
||||
// Toggle todos
|
||||
if(state.state.view == 'day' || this.state.view == 'day')
|
||||
{
|
||||
|
@ -930,7 +930,7 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
|
||||
if(columns[c][i].div.is(':visible'))
|
||||
{
|
||||
var border_diff = columns[c][i].div.outerHeight() - columns[c][i].div.height();
|
||||
columns[c][i].div.css('height',columns[c][i].div.height() - border_diff);
|
||||
columns[c][i].div.css('height','calc('+height+'% - ' +border_diff+')');
|
||||
}
|
||||
// This gives the wrong height
|
||||
//columns[c][i].div.outerHeight(height+'%');
|
||||
@ -1074,10 +1074,18 @@ var et2_calendar_daycol = (function(){ "use strict"; return et2_valueWidget.exte
|
||||
{
|
||||
// Layout has changed
|
||||
this._draw();
|
||||
}
|
||||
// Resize & position all events
|
||||
this.position_event();
|
||||
|
||||
// Resize & position all events
|
||||
this.position_event();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't need to resize & reposition, just clear some stuff
|
||||
// to reset for _out_of_view()
|
||||
this.iterateOver(function(widget) {
|
||||
widget._small_size();
|
||||
}, this, et2_calendar_event);
|
||||
}
|
||||
this._out_of_view();
|
||||
}
|
||||
});}).call(this);
|
||||
|
@ -613,11 +613,20 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
||||
},
|
||||
|
||||
set_disabled: function(disabled) {
|
||||
var old_value = this.options.disabled;
|
||||
this._super.apply(this, arguments);
|
||||
if(disabled)
|
||||
{
|
||||
this.loader.show();
|
||||
}
|
||||
else if (old_value !== disabled)
|
||||
{
|
||||
// Scroll to start of day - stops jumping in FF
|
||||
// For some reason on Chrome & FF this doesn't quite get the day start
|
||||
// to the top, so add 2px;
|
||||
this.scrolling.scrollTop(this._top_time+2);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@ -761,7 +770,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
||||
window.clearTimeout(this.resize_timer);
|
||||
}
|
||||
// No point if it is just going to be redone completely
|
||||
if(this.upate_timer) return;
|
||||
if(this.update_timer) return;
|
||||
|
||||
this.resize_timer = window.setTimeout(jQuery.proxy(function() {
|
||||
if(this._resizeTimes)
|
||||
|
Loading…
Reference in New Issue
Block a user