PDA

View Full Version : [2.0a1][SOLVED] IE invalid argument in grid.layout



suntoast
3 Oct 2007, 8:07 AM
Info:
- Ext 2.0a1 (we noticed the issue in the first release of Ext2 into svn)
- prototype adapter
- ie6

I can't show you a way to reproduce this, but it happens when the grid panel is hidden, and it only happens in IE, so it's hard to do a stack trace.

For some reason c.getSize(true) is returning a width of -2, which IE can't handle.
The second problem is that sometimes this.innerHd was not set, so i added a test for that.

See below.




Ext.extend(Ext.grid.GridView, Ext.util.Observable, {
...

, layout : function(){
if(!this.mainBody){
return; // not rendered
}
var g = this.grid;
var c = g.getGridEl(), cm = this.cm,
expandCol = g.autoExpandColumn,
gv = this;

var csize = c.getSize(true);
var vw = csize.width;

// another problem in IE - negative vw
if(!vw || !csize.height || vw < 0){ // display: none?
return;
}

if(g.autoHeight){
this.scroller.dom.style.overflow = 'visible';
}else{
this.el.setSize(csize.width, csize.height);

var hdHeight = this.mainHd.getHeight();
var vh = csize.height - (hdHeight);

this.scroller.setSize(vw, vh);
// source of many IE related problems
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.onLayout(vw, vh);
}

...
}

mystix
3 Oct 2007, 8:09 AM
as per 13985, are you using ext-base.js?

suntoast
3 Oct 2007, 9:01 AM
Sorry about missing the good info.... initial post has been updated to show prototype adaptor.

jack.slocum
4 Oct 2007, 1:25 AM
Thanks, similar changes will be in the next check-in.

ZaDDaZ
9 Oct 2007, 10:28 PM
Should we not adjust the getHeight and getWidth methods so that they will never return a negative width. What is happening is that the offsetHeight and offsetWidth properties are coming back as 0 when the panel content is not visible and the padding is coming back as 1 for each side, and getHeight and getWidth return the offset values minus the padding, which is why the return of them is negative 2. I simply put in a check in those functions for a negative value and return 0 instead. I'm sure there are other things that will suffer from this issue other than the grids.


getHeight : function(contentHeight){
var h = this.dom.offsetHeight || 0;
h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
if (h < 0) h = 0;
return h;
},


getWidth : function(contentWidth){
var w = this.dom.offsetWidth || 0;
w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
if (w < 0) w = 0;
return w;
},

jack.slocum
10 Oct 2007, 9:53 AM
That's a good suggestion. I will roll it in.