X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/examples/ux/RowLayout.js diff --git a/examples/ux/RowLayout.js b/examples/ux/RowLayout.js index 3ec31d61..85ec7648 100644 --- a/examples/ux/RowLayout.js +++ b/examples/ux/RowLayout.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -73,22 +73,43 @@ Ext.ux.layout.RowLayout = Ext.extend(Ext.layout.ContainerLayout, { // private monitorResize:true, + type: 'row', + + // private + allowContainerRemove: false, + // private isValidParent : function(c, target){ - return c.getEl().dom.parentNode == this.innerCt.dom; + return this.innerCt && c.getPositionEl().dom.parentNode == this.innerCt.dom; + }, + + getLayoutTargetSize : function() { + var target = this.container.getLayoutTarget(), ret; + if (target) { + ret = target.getViewSize(); + ret.width -= target.getPadding('lr'); + ret.height -= target.getPadding('tb'); + } + return ret; + }, + + renderAll : function(ct, target) { + if(!this.innerCt){ + // the innerCt prevents wrapping and shuffling while + // the container is resizing + this.innerCt = target.createChild({cls:'x-column-inner'}); + this.innerCt.createChild({cls:'x-clear'}); + } + Ext.layout.ColumnLayout.superclass.renderAll.call(this, ct, this.innerCt); }, // private onLayout : function(ct, target){ var rs = ct.items.items, len = rs.length, r, i; - if(!this.innerCt){ - target.addClass('ux-row-layout-ct'); - this.innerCt = target.createChild({cls:'x-row-inner'}); - } - this.renderAll(ct, this.innerCt); + this.renderAll(ct, target); - var size = target.getViewSize(true); + var size = this.getLayoutTargetSize(); if(size.width < 1 && size.height < 1){ // display none? return; @@ -105,7 +126,7 @@ Ext.ux.layout.RowLayout = Ext.extend(Ext.layout.ContainerLayout, { for(i = 0; i < len; i++){ r = rs[i]; if(!r.rowHeight){ - ph -= (r.getSize().height + r.getEl().getMargins('tb')); + ph -= (r.getHeight() + r.getEl().getMargins('tb')); } } @@ -117,6 +138,20 @@ Ext.ux.layout.RowLayout = Ext.extend(Ext.layout.ContainerLayout, { r.setSize({height: Math.floor(r.rowHeight*ph) - r.getEl().getMargins('tb')}); } } + + // Browsers differ as to when they account for scrollbars. We need to re-measure to see if the scrollbar + // spaces were accounted for properly. If not, re-layout. + if (Ext.isIE) { + if (i = target.getStyle('overflow') && i != 'hidden' && !this.adjustmentPass) { + var ts = this.getLayoutTargetSize(); + if (ts.width != size.width){ + this.adjustmentPass = true; + this.layoutTargetSize = ts; + this.onLayout(ct, target); + } + } + } + delete this.adjustmentPass; } /**