* @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
size: '',
- maxWidth: 0,
-
+ max_width: 0,
+
+ fit_content: false,
onRender : function(ct, position)
{
var w = this.width || Roo.lib.Dom.getViewportWidth(true) - 30;
var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 60;
this.setSize(w,h);
+ return;
}
- if(!this.fitwindow && this.maxWidth !== 0){
+ if(this.max_width !== 0) {
+
+ 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;
+ }
+
+ if(!this.fit_content) {
+ this.setSize(w, Roo.lib.Dom.getViewportHeight(true) - 60);
+ 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;
+ }
- 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);
+ this.setSize(w, Math.min(full_height, Roo.lib.Dom.getViewportHeight(true) - 60));
}
},