kevinconaway
11 Dec 2008, 11:50 AM
Judging by past forum posts, this issue has come up many times without much success.
Is this feature going to be added to the GridPanel any time soon? My solution is below and it would be nice to see it (or an alternate implementation) included in the next release.
Thanks
Ext.override(Ext.grid.GridView, {
layout : function() {
if(!this.mainBody) {
return;
}
var g = this.grid;
var c = g.getGridEl();
var csize = c.getSize(true);
var vw = csize.width;
if(vw < 20 || csize.height < 20) {
return;
}
var ltMax = true;
if (this.maxHeight) {
ltMax = csize.height < this.maxHeight;
}
if (g.autoHeight && ltMax) {
this.scroller.dom.style.overflow = 'visible';
} else {
var height = csize.height;
if (this.maxHeight) {
if (height > this.maxHeight) {
height = this.maxHeight;
this.scroller.dom.style.overflow = '';
}
}
this.el.setSize(csize.width, height);
var hdHeight = this.mainHd.getHeight();
var vh = height - (hdHeight);
this.scroller.setSize(vw, vh);
if(this.innerHd){
this.innerHd.style.width = (vw)+'px';
}
}
if(this.forceFit){
if(this.lastViewWidth != vw){
this.fitColumns(false, false);
this.lastViewWidth = vw;
}
}else {
this.autoExpand();
this.syncHeaderScroll();
}
this.onLayout(vw, vh);
}
});Usage:
var grid = new Ext.grid.GridPanel({
autoHeight: true,
viewConfig: {
maxHeight: 200
}
});
Is this feature going to be added to the GridPanel any time soon? My solution is below and it would be nice to see it (or an alternate implementation) included in the next release.
Thanks
Ext.override(Ext.grid.GridView, {
layout : function() {
if(!this.mainBody) {
return;
}
var g = this.grid;
var c = g.getGridEl();
var csize = c.getSize(true);
var vw = csize.width;
if(vw < 20 || csize.height < 20) {
return;
}
var ltMax = true;
if (this.maxHeight) {
ltMax = csize.height < this.maxHeight;
}
if (g.autoHeight && ltMax) {
this.scroller.dom.style.overflow = 'visible';
} else {
var height = csize.height;
if (this.maxHeight) {
if (height > this.maxHeight) {
height = this.maxHeight;
this.scroller.dom.style.overflow = '';
}
}
this.el.setSize(csize.width, height);
var hdHeight = this.mainHd.getHeight();
var vh = height - (hdHeight);
this.scroller.setSize(vw, vh);
if(this.innerHd){
this.innerHd.style.width = (vw)+'px';
}
}
if(this.forceFit){
if(this.lastViewWidth != vw){
this.fitColumns(false, false);
this.lastViewWidth = vw;
}
}else {
this.autoExpand();
this.syncHeaderScroll();
}
this.onLayout(vw, vh);
}
});Usage:
var grid = new Ext.grid.GridPanel({
autoHeight: true,
viewConfig: {
maxHeight: 200
}
});