Roo/bootstrap/Modal.js
[roojs1] / Roo / bootstrap / Modal.js
index 0317471..0708b56 100644 (file)
@@ -269,21 +269,22 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         }
         
         if(!this.fitwindow && this.max_width !== 0){
+            
             var w = Math.min(this.max_width, Roo.lib.Dom.getViewportWidth(true) - 30);
-            // var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 60;
-            this.setSize(w, this.height || Roo.lib.Dom.getViewportHeight(true) - 60);
-            Roo.log(this.bodyEl.dom.offsetHeight);
-            var view_height = Roo.lib.Dom.getViewportHeight(true) - 60;
-            // 
-            // if(
-            //     (
-            //         this.headerEl.getHeight() + 
-            //         this.bodyEl.getHeight() + 
-            //         this.footerEl.getHeight()
-            //     ) > view_height) {
-            // } {
-            //     this.setSize(w,view_height);
-            // }
+            
+            // for fix height
+            if(this.height) {
+                this.setSize(w, this.height || Roo.lib.Dom.getViewportWidth(true) - 30);
+                return;
+            }
+            
+            var body_childs = this.bodyEl.dom.childNodes;
+            var full_height = this.headerEl.getHeight() + this.footerEl.getHeight();
+            for(var i = 0; i < body_childs.length; i++) {
+                full_height += body_childs[i].offsetHeight;
+            }
+            
+            // this.setSize(w, Math.min(full_height, Roo.lib.Dom.getViewportHeight(true) - 60));
         }
         
     },