X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FLayoutRegion.js;h=55a88b2aa9146c426a8dc7f253419312b31e859a;hb=0b69a11b1055a6d3a3fd0719bdd58b5a235de0e4;hp=c0c55a8d1f2b2f78f8dc82473f9a1e258a1cb994;hpb=833d4c6398d6dadec8633f59035f3e3e1e7f8c50;p=roojs1 diff --git a/Roo/LayoutRegion.js b/Roo/LayoutRegion.js index c0c55a8d1f..55a88b2aa9 100644 --- a/Roo/LayoutRegion.js +++ b/Roo/LayoutRegion.js @@ -302,22 +302,29 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { * Collapses this region. * @param {Boolean} skipAnim (optional) true to collapse the element without animation (if animate is true) */ - collapse : function(skipAnim){ - if(this.collapsed) return; - this.collapsed = true; - if(this.split){ - this.split.el.hide(); - } - if(this.config.animate && skipAnim !== true){ - this.fireEvent("invalidated", this); - this.animateCollapse(); - }else{ - this.el.setLocation(-20000,-20000); - this.el.hide(); - this.collapsedEl.show(); - this.fireEvent("collapsed", this); - this.fireEvent("invalidated", this); + collapse : function(skipAnim, skipCheck){ + if(this.collapsed) { + return; + } + + if(skipCheck || this.fireEvent("beforecollapse", this) != false){ + + this.collapsed = true; + if(this.split){ + this.split.el.hide(); + } + if(this.config.animate && skipAnim !== true){ + this.fireEvent("invalidated", this); + this.animateCollapse(); + }else{ + this.el.setLocation(-20000,-20000); + this.el.hide(); + this.collapsedEl.show(); + this.fireEvent("collapsed", this); + this.fireEvent("invalidated", this); + } } + }, animateCollapse : function(){ @@ -330,8 +337,12 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { * @param {Boolean} skipAnim (optional) true to expand the element without animation (if animate is true) */ expand : function(e, skipAnim){ - if(e) e.stopPropagation(); - if(!this.collapsed || this.el.hasActiveFx()) return; + if(e) { + e.stopPropagation(); + } + if(!this.collapsed || this.el.hasActiveFx()) { + return; + } if(this.isSlid){ this.afterSlideIn(); skipAnim = true; @@ -444,7 +455,7 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { */ showPanel : function(panel) { - var panel = this.getPanel(panel); + panel = this.getPanel(panel); if(panel){ if(this.tabs){ var tab = this.tabs.getTab(panel.getEl().id);