Keep all timegrids in the same sizing state new the transition when only some might fit

This commit is contained in:
Nathan Gray 2016-02-09 21:02:01 +00:00
parent d7dfd44c8b
commit d2e34a5812

View File

@ -1696,13 +1696,16 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
}, },
// Resizable interface // Resizable interface
resize: function () /**
* @param {boolean} [too_small=null] Force the widget to act as if it was too small
*/
resize: function (_too_small)
{ {
if(this.disabled || !this.div.is(':visible')) if(this.disabled || !this.div.is(':visible'))
{ {
return; return;
} }
// Set the max width to avoid animations screwing up the width // Set the max width to avoid animations screwing up the width
this.div.css('max-width',$j(this.getInstanceManager().DOMContainer).width()); this.div.css('max-width',$j(this.getInstanceManager().DOMContainer).width());
@ -1740,20 +1743,22 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
$j(this.getInstanceManager().DOMContainer) $j(this.getInstanceManager().DOMContainer)
.css({ .css({
'overflow-y': too_small ? 'auto' : 'hidden', 'overflow-y': too_small || _too_small ? 'auto' : 'hidden',
'overflow-x': 'hidden', 'overflow-x': 'hidden',
'height': too_small ? height : '100%' 'height': too_small || _too_small ? height : '100%'
}); });
if(too_small) if(too_small || _too_small)
{ {
this.options.height = needed; this.options.height = needed;
if(!this.div.hasClass('calendar_calTimeGridFixed')) // Set all others to match
if(!_too_small)
{ {
window.setTimeout(jQuery.proxy(function() { window.setTimeout(jQuery.proxy(function() {
this._parent.iterateOver(function(widget) { this._parent.iterateOver(function(widget) {
if(!widget.disabled) widget.resize(); if(!widget.disabled) widget.resize(true);
},this, et2_calendar_timegrid); },this, et2_calendar_timegrid);
},this),1); },this),1);
return;
} }
this.div.addClass('calendar_calTimeGridFixed'); this.div.addClass('calendar_calTimeGridFixed');
} }