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,
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);
+
+ Roo.log(this.height);
+
+ 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 body_height = 0;
+ for(var i = 0; i < body_childs.length; i++) {
+ body_height += body_childs[i].offsetHeight;
+ }
+
+ // this.setSize(w, this.height || view_height);
+
+
+
+ //
+ // if(
+ // (
+ // this.headerEl.getHeight() +
+ // this.bodyEl.getHeight() +
+ // this.footerEl.getHeight()
+ // ) > view_height) {
+ // } {
+ // this.setSize(w,view_height);
+ // }
+ }
+
},
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} autoHideFooter auto hide footer if only one page (default false)
+ * @cfg {Boolean} auto_hide_footer auto hide footer if only one page (default false)
*
* @constructor
CSS : Roo.util.CSS,
- autoHideFooter : false,
+ auto_hide_footer : false,
getAutoCreate : function()
{
//Roo.log('initEvents with ds!!!!');
- this.mainBody = this.el.select('tbody', true).first().setVisibilityMode(Roo.Element.DISPLAY);
- this.mainHead = this.el.select('thead', true).first().setVisibilityMode(Roo.Element.DISPLAY);
- this.mainFoot = this.el.select('tfoot', true).first().setVisibilityMode(Roo.Element.DISPLAY);
+ this.mainBody = this.el.select('tbody', true).first();
+ this.mainHead = this.el.select('thead', true).first();
+ this.mainFoot = this.el.select('tfoot', true).first();
var tfoot = this.el.select('tfoot', true).first();
- if(this.footerShow && this.autoHideFooter && this.mainFoot){
+ if(this.footerShow && this.auto_hide_footer && this.mainFoot){
- this.mainFoot.hide();
+ this.mainFoot.setVisibilityMode(Roo.Element.DISPLAY).hide();
- if(this.footer.pageSize < ds.getCount()){
+ var total = this.ds.getTotalCount();
+
+ if(this.footer.pageSize < total){
this.mainFoot.show();
}
}
}
+ 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]);