PDA

View Full Version : GridView layout


vtswingkid
04-27-2007, 12:04 PM
IE7 is complaining that lw is undefined in this GridView.layout function. var lw is defined after this first reference. I guess none of the other browsers are getting there. I suppose the same will apply to mw also.


layout : function(initialRender, is2ndPass){
var g = this.grid;
var auto = g.autoHeight;
var scrollOffset = 16;
var c = g.container, cm = this.cm,
expandCol = g.autoExpandColumn,
gv = this;
//c.beginMeasure();
var lw = this.lockedWrap, mw = this.mainWrap; //<<<<<=======move definition here======
var lb = this.lockedBody, mb = this.mainBody; //<<<<<========move definition here======
if(!c.dom.offsetWidth){ // display:none?
if(initialRender){
lw.show();//<<<<<============before definition==================
mw.show();//<<<<<===========before definition=================
}
return;
}
var hasLock = this.cm.isLocked(0);
var tbh = this.headerPanel.getHeight();
var bbh = this.footerPanel.getHeight();
if(auto){
var ch = this.getBodyTable().offsetHeight + tbh + bbh + this.mainHd.getHeight();
var newHeight = ch + c.getBorderWidth("tb");
if(g.maxHeight){
newHeight = Math.min(g.maxHeight, newHeight);
}
c.setHeight(newHeight);
}
if(g.autoWidth){
c.setWidth(cm.getTotalWidth()+c.getBorderWidth('lr '));
}
var s = this.scroller;
var csize = c.getSize(true);
this.el.setSize(csize.width, csize.height);
this.headerPanel.setWidth(csize.width);
this.footerPanel.setWidth(csize.width);
var hdHeight = this.mainHd.getHeight();
var vw = csize.width;
var vh = csize.height - (tbh + bbh);
s.setSize(vw, vh);
var bt = this.getBodyTable();
var ltWidth = hasLock ?
Math.max(this.getLockedTable().offsetWidth, this.lockedHd.dom.firstChild.offsetWidth) : 0;
var scrollHeight = bt.offsetHeight;
var scrollWidth = ltWidth + bt.offsetWidth;
var vscroll = false, hscroll = false;
this.scrollSizer.setSize(scrollWidth, scrollHeight+hdHeight);
//var lw = this.lockedWrap, mw = this.mainWrap; //<<<<<=======definition======
//var lb = this.lockedBody, mb = this.mainBody; //<<<<<========definition======
setTimeout(function(){
var t = s.dom.offsetTop;
var w = s.dom.clientWidth,
h = s.dom.clientHeight;
lw.setTop(t);
lw.setSize(ltWidth, h);
mw.setLeftTop(ltWidth, t);
mw.setSize(w-ltWidth, h);
lb.setHeight(h-hdHeight);
mb.setHeight(h-hdHeight);
if(is2ndPass !== true && !gv.userResized && expandCol){
// high speed resize without full column calculation
var ci = cm.getIndexById(expandCol);
var tw = cm.getTotalWidth(false);
var currentWidth = cm.getColumnWidth(ci);
var cw = Math.min(Math.max(((w-tw)+currentWidth-2)-/*scrollbar*/(w <= s.dom.offsetWidth ? 0 : 18), g.autoExpandMin), g.autoExpandMax);
if(currentWidth != cw){
cm.setColumnWidth(ci, cw, true);
gv.css.updateRule(gv.colSelector+expandCol, "width", (cw - gv.borderWidth) + "px");
gv.css.updateRule(gv.hdSelector+expandCol, "width", (cw - gv.borderWidth) + "px");
gv.updateSplitters();
gv.layout(false, true);
}
}
if(initialRender){
lw.show();
mw.show();
}
//c.endMeasure();
}, 10);
}



EDIT: Moved the definitions up. I don't know if that is the right, I didn't really study the code

tryanDLS
04-27-2007, 02:10 PM
Fixed in SVN, but not checked in yet.

EDIT: fixed in SVN:275

kaps77
10-05-2007, 09:50 AM
Hi,
I am facing a similar issue in IE, the "column model" cm in the following line turns out to be "null" -
var hasLock = this.cm.isLocked(0);

in the following function- layout : function(initialRender, is2ndPass)
line number- 28375 (ext-all-debug.js)

The Extjs version is 1.1
Is this a known issue?

mystix
10-05-2007, 10:03 AM
@kaps77, pls post details as per 8887 with a simple test case to demonstrate the problem.