PDA

View Full Version : EditorGridPanel with autoHeight and maxHeight



RobertT
27 Jan 2011, 1:50 AM
Hello everybody

I found an override that they say it solves the problem of using autoHeight and maxHeight for a grid


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);
}
});

which should be implemented with


autoHeight: true,
viewConfig: { maxHeight: 200}


However it doesn't work for the EditorGridPanel (although it extens GridPanel for which GridView is the user interface).

I tried replacing the override to
Ext.override(Ext.grid.EditorGridPanel, {...});

but it gives a firebug error layout.setContainer is not a function (layout.setContainer(this);)

Anybody has done something similar?
Any help appreciated.

Thanks