Roo/bootstrap/Modal.js
[roojs1] / Roo / bootstrap / Modal.js
index 935eb50..c2dc2fb 100644 (file)
@@ -271,8 +271,23 @@ 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,h);
+            
+            if(this.height) {
+                this.setSize(w, this.height);
+                return;
+            }
+            
+            var view_height = Roo.lib.Dom.getViewportHeight(true) - 60;
+            var body_childs = this.bodyEl.dom.childNodes;
+            var full_height = 0;
+            for(var i = 0; i < body_childs.length; i++) {
+                full_height += body_childs[i].offsetHeight;
+            }
+            
+            if(body_height + this.headerEl.getHeight() + this.footerEl.getHeight() > view_height) {
+                this.setSize(w, Math.min);
+            }
+            
         }
         
     },