X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FLayoutRegion.js;h=55a88b2aa9146c426a8dc7f253419312b31e859a;hb=0b69a11b1055a6d3a3fd0719bdd58b5a235de0e4;hp=5dd3ed36cad9a5be639ad091c16bb09d4c3ed6ab;hpb=e1418af3f0054f6050f91957f86cc48611912496;p=roojs1 diff --git a/Roo/LayoutRegion.js b/Roo/LayoutRegion.js index 5dd3ed36ca..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; @@ -442,8 +453,10 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { * @param {Number/String/ContentPanel} panelId The panel's index, id or the panel itself * @return {Roo.ContentPanel} The shown panel, or null if a panel could not be found from panelId */ - showPanel : function(panel){ - if(panel = this.getPanel(panel)){ + showPanel : function(panel) + { + panel = this.getPanel(panel); + if(panel){ if(this.tabs){ var tab = this.tabs.getTab(panel.getEl().id); if(tab.isHidden()){