this.getVisibilityEl().removeClass('hidden');
+ this.fireEvent('show', this);
+
},
/**
this.getVisibilityEl().addClass('hidden');
+ this.fireEvent('hide', this);
+
}
});
* @cfg {Boolean} allow_close default true
* @cfg {Boolean} fitwindow default false
* @cfg {String} size (sm|lg) default empty
+ * @cfg {Number} max_width set the max width of modal
*
*
* @constructor
closeEl: false,
size: '',
-
+
+ max_width: 0,
+
+ fit_content: false,
onRender : function(ct, position)
{
},
- getAutoCreate : function(){
-
-
+ getAutoCreate : function()
+ {
var bdy = {
cls : 'modal-body',
html : this.html || ''
resize : function()
{
this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true), Roo.lib.Dom.getViewHeight(true));
+
if (this.fitwindow) {
var w = this.width || Roo.lib.Dom.getViewportWidth(true) - 30;
var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 60;
this.setSize(w,h);
}
+
+ if(!this.fitwindow && 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);
+ }
+
+ 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)
}).defer(50, this);
}else{
this.el.addClass('in');
-
}
// not sure how we can show data in here..
* @cfg {Boolean} scrollBody (true|false) default false - body scrolled / fixed header
* @cfg {Roo.bootstrap.PagingToolbar} footer a paging toolbar
* @cfg {Boolean} lazyLoad auto load data while scrolling to the end (default false)
+ * @cfg {Boolean} auto_hide_footer auto hide footer if only one page (default false)
*
* @constructor
CSS : Roo.util.CSS,
+ auto_hide_footer : false,
+
getAutoCreate : function()
{
var cfg = Roo.apply({}, Roo.bootstrap.Table.superclass.getAutoCreate.call(this));
'summary',
'width'
].forEach(function(k) {
- if (t[k]) {
- cfg[k] = t[k];
+ if (_t[k]) {
+ cfg[k] = _t[k];
}
});
this.mainBody = this.el.select('tbody', true).first();
this.mainHead = this.el.select('thead', true).first();
-
+ this.mainFoot = this.el.select('tfoot', true).first();
}, this);
}
+ var tfoot = this.el.select('tfoot', true).first();
+
+ if(this.footerShow && this.auto_hide_footer && this.mainFoot){
+
+ this.mainFoot.setVisibilityMode(Roo.Element.DISPLAY).hide();
+
+ var total = this.ds.getTotalCount();
+
+ if(this.footer.pageSize < total){
+ this.mainFoot.show();
+ }
+ }
+
Roo.each(this.el.select('tbody td', true).elements, function(e){
e.on('mouseover', _this.onMouseover, _this);
});
return;
}
+ Roo.log('invalid field: ' + f.name);
+
valid = false;
if(!target && f.el.isVisible(true)){
}
+ if(this.indicator){
+ this.indicator.removeClass('visible');
+ this.indicator.addClass(this.indicatorpos == 'right' ? 'hidden' : 'invisible');
+ }
+
this.fireEvent('valid', this);
},
this.list.on('scroll', this.onViewScroll, this);
if(!this.tpl){
- this.tpl = '<li class="roo-select2-result"><div class="checkbox"><input id="{roo-id}" type="checkbox" {roo-data-checked}><label for="{roo-id}"><b>{' + this.displayField + '}</b></label></div></li>';
+ this.tpl = '<li class="roo-select2-result"><div class="checkbox"><input id="{roo-id}"' +
+ 'type="checkbox" {roo-data-checked}><label for="{roo-id}"><b>{' + this.displayField + '}</b></label></div></li>';
}
this.view = new Roo.View(this.list, this.tpl, {
- singleSelect:true, tickable:true, parent:this, store: this.store, selectedClass: this.selectedClass
+ singleSelect:true,
+ tickable:true,
+ parent:this,
+ store: this.store,
+ selectedClass: this.selectedClass
});
//this.view.wrapEl.setDisplayed(false);
this.showMode();
if(this.isInline) {
- this.show();
+ this.showPopup();
}
},
onFocus : function()
{
Roo.bootstrap.DateField.superclass.onFocus.call(this);
- this.show();
+ this.showPopup();
},
onBlur : function()
this.setValue(d);
- this.hide();
+ this.hidePopup();
},
- show : function()
+ showPopup : function()
{
this.picker().show();
this.update();
this.place();
- this.fireEvent('show', this, this.date);
+ this.fireEvent('showpopup', this, this.date);
},
- hide : function()
+ hidePopup : function()
{
if(this.isInline) {
return;
this.viewMode = this.startViewMode;
this.showMode();
- this.fireEvent('hide', this, this.date);
+ this.fireEvent('hidepopup', this, this.date);
},
{
if (!this.picker().isVisible()){
if (e.keyCode == 27) { // allow escape to hide and re-show picker
- this.show();
+ this.showPopup();
}
return;
}
switch(e.keyCode){
case 27: // escape
- this.hide();
+ this.hidePopup();
e.preventDefault();
break;
case 37: // left
break;
case 13: // enter
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
e.preventDefault();
break;
case 9: // tab
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
break;
case 16: // shift
case 17: // ctrl
// this.fill()
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
break;
}
break;
if(this.singleMode){
this.setValue(this.formatDate(this.viewDate));
- this.hide();
+ this.hidePopup();
return;
}
// this.fill();
//Roo.log(this.formatDate(this.date));
this.setValue(this.formatDate(this.date));
- this.hide();
+ this.hidePopup();
}
break;
}
this.date = this.viewDate = '';
Roo.bootstrap.DateField.superclass.setValue.call(this, '');
- },
-
- setVisible : function(visible)
- {
- if(!this.getEl()){
- return;
- }
-
- this.getEl().removeClass('hidden');
-
- if(visible){
- return;
- }
-
- this.getEl().addClass('hidden');
}
});
placement = 'top';
}
+ align = this.alignment[placement];
}
this.el.alignTo(this.bindEl, align[0],align[1]);
* @param {Roo.bootstrap.DocumentManager} this
* @param {Object} file
*/
- "previewrendered" : true
+ "previewrendered" : true,
+ /**
+ */
+ "previewResize" : true
});
};
var width = image.dom.naturalWidth || image.dom.width;
var height = image.dom.naturalHeight || image.dom.height;
+ if(!this.previewResize) {
+ return;
+ }
+
if(width > height){
file.target.addClass('wide');
return;