Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / docs / source / ColumnLayout.html
index a401db9..13308f5 100644 (file)
@@ -68,6 +68,8 @@ Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
     // private\r
     monitorResize:true,\r
 \r
     // private\r
     monitorResize:true,\r
 \r
+    type: 'column',\r
+\r
     extraCls: 'x-column',\r
 \r
     scrollOffset : 0,\r
     extraCls: 'x-column',\r
 \r
     scrollOffset : 0,\r
@@ -77,22 +79,36 @@ Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
     targetCls: 'x-column-layout-ct',\r
 \r
     isValidParent : function(c, target){\r
     targetCls: 'x-column-layout-ct',\r
 \r
     isValidParent : function(c, target){\r
-        return c.getPositionEl().dom.parentNode == this.innerCt.dom;\r
+        return this.innerCt && c.getPositionEl().dom.parentNode == this.innerCt.dom;\r
     },\r
 \r
     },\r
 \r
-    // private\r
-    onLayout : function(ct, target){\r
-        var cs = ct.items.items, len = cs.length, c, i;\r
+    getLayoutTargetSize : function() {\r
+        var target = this.container.getLayoutTarget(), ret;\r
+        if (target) {\r
+            ret = target.getViewSize();\r
+            ret.width -= target.getPadding('lr');\r
+            ret.height -= target.getPadding('tb');\r
+        }\r
+        return ret;\r
+    },\r
 \r
 \r
+    renderAll : function(ct, target) {\r
         if(!this.innerCt){\r
             // the innerCt prevents wrapping and shuffling while\r
             // the container is resizing\r
             this.innerCt = target.createChild({cls:'x-column-inner'});\r
             this.innerCt.createChild({cls:'x-clear'});\r
         }\r
         if(!this.innerCt){\r
             // the innerCt prevents wrapping and shuffling while\r
             // the container is resizing\r
             this.innerCt = target.createChild({cls:'x-column-inner'});\r
             this.innerCt.createChild({cls:'x-clear'});\r
         }\r
-        this.renderAll(ct, this.innerCt);\r
+        Ext.layout.ColumnLayout.superclass.renderAll.call(this, ct, this.innerCt);\r
+    },\r
 \r
 \r
-        var size = target.getViewSize(true);\r
+    // private\r
+    onLayout : function(ct, target){\r
+        var cs = ct.items.items, len = cs.length, c, i;\r
+\r
+        this.renderAll(ct, target);\r
+\r
+        var size = this.getLayoutTargetSize();\r
 \r
         if(size.width < 1 && size.height < 1){ // display none?\r
             return;\r
 \r
         if(size.width < 1 && size.height < 1){ // display none?\r
             return;\r
@@ -110,7 +126,7 @@ Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
         for(i = 0; i < len; i++){\r
             c = cs[i];\r
             if(!c.columnWidth){\r
         for(i = 0; i < len; i++){\r
             c = cs[i];\r
             if(!c.columnWidth){\r
-                pw -= (c.getSize().width + c.getPositionEl().getMargins('lr'));\r
+                pw -= (c.getWidth() + c.getPositionEl().getMargins('lr'));\r
             }\r
         }\r
 \r
             }\r
         }\r
 \r
@@ -122,6 +138,19 @@ Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {
                 c.setSize(Math.floor(c.columnWidth * pw) - c.getPositionEl().getMargins('lr'));\r
             }\r
         }\r
                 c.setSize(Math.floor(c.columnWidth * pw) - c.getPositionEl().getMargins('lr'));\r
             }\r
         }\r
+\r
+        // Browsers differ as to when they account for scrollbars.  We need to re-measure to see if the scrollbar\r
+        // spaces were accounted for properly.  If not, re-layout.\r
+        if (Ext.isIE) {\r
+            if (i = target.getStyle('overflow') && i != 'hidden' && !this.adjustmentPass) {\r
+                var ts = this.getLayoutTargetSize();\r
+                if (ts.width != size.width){\r
+                    this.adjustmentPass = true;\r
+                    this.onLayout(ct, target);\r
+                }\r
+            }\r
+        }\r
+        delete this.adjustmentPass;\r
     }\r
 \r
     <div id="prop-Ext.layout.ColumnLayout-activeItem"></div>/**\r
     }\r
 \r
     <div id="prop-Ext.layout.ColumnLayout-activeItem"></div>/**\r