Roo/bootstrap/Modal.js
[roojs1] / Roo / bootstrap / Modal.js
index 6935b94..3344594 100644 (file)
@@ -17,7 +17,7 @@
  * @cfg {Boolean} allow_close default true
  * @cfg {Boolean} fitwindow default false
  * @cfg {String} size (sm|lg) default empty
- * @cfg {Number} maxWidth set the maxWidth of modal
+ * @cfg {Number} max_width set the max width of modal
  *
  *
  * @constructor
@@ -83,7 +83,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
 
     size: '',
     
-    maxWidth: 0,
+    max_width: 0,
 
 
     onRender : function(ct, position)
@@ -268,20 +268,36 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
             this.setSize(w,h);
         }
         
-        if(!this.fitwindow && this.maxWidth !== 0){
+        if(!this.fitwindow && this.max_width !== 0){
             
-            var w = Math.min(this.maxWidth, Roo.lib.Dom.getViewportWidth(true) - 30);
-//            var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 60;
-//            this.setSize(w,h);
-            this.dialogEl.setWidth(w);
+            var w = Math.min(this.max_width, Roo.lib.Dom.getViewportWidth(true) - 30);
+            
+            // for fix height
+            if(this.height) {
+                this.setSize(w, this.height);
+                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++) {
+                
+                if(body_childs[i].classList.indexOf('roo-layout-region') * 1 != -1) {
+                    var layout_childs = body_childs[i].childNodes;
+                    for(var j = 0; j < layout_childs.length; j++) {
+                    
+                }
+                
+                full_height += body_childs[i].offsetHeight;
+            }
+            
+            // this.setSize(w, Math.min(full_height, Roo.lib.Dom.getViewportHeight(true) - 60));
         }
         
     },
 
     setSize : function(w,h)
     {
-        Roo.log('set size!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
-        Roo.log([w, h]);
         if (!w && !h) {
             return;
         }
@@ -392,8 +408,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     resizeTo: function(w,h)
     {
         // skip.. ?? why??
-        Roo.log('resize to !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1');
-        Roo.log([w, h]);
+
         this.dialogEl.setWidth(w);
         if (this.diff === false) {
             this.diff = this.dialogEl.getHeight() - this.bodyEl.getHeight();