PDA

View Full Version : [Ext 1.1.1] autoHeight preference is overwritten during render()



timo.nuros
4 Oct 2007, 12:19 AM
Hi,

I've got a complex borderLayout which includes a nestedLayout on a hidden tab, and that nestedLayout contains split borderLayout with a grid. I was debugging for at least 8 hours to find out why the grid doesn't fit to the height of the container. The layout is completely created from JavaScript, no single HTML fragment exists.

My grid has explicitely set autoHeight: false in the configuration.

I started debugging the ext library and found this one in grid.js around line 392:


render : function(){
var c = this.container;
// try to detect autoHeight/width mode
if((!c.dom.offsetHeight || c.dom.offsetHeight < 20) || c.getStyle("height") == "auto"){
this.autoHeight = true;
}

This is where it fails. If I explicitely set grid.autoHeight=false after calling render(), it works. In my case, autoHeight is set by render() because c.dom.offsetHeight is not defined, most probably because the grid is placed on a tab which contents are initially invisible and where the layout engine didn't update anything yet.

I feel that this behaviour is a bug and should be fixed, if it exists in 2.0.

If you need a code sample, please let me know.

cheers,
Timo

mystix
4 Oct 2007, 12:57 AM
8887

details?

timo.nuros
4 Oct 2007, 2:40 AM
I felt that it wasn't required to put in any browser sample, as I already identified the code line where the problem occurs, but ok, here we go

The problem described above occurs in Firefox 1, 2, IE7 and IE6 on Windows XP and 2000.

Ext JS Library 1.1.1, Adapter ext-base

Yes, I searched the forum and found alot of users who got the same problem, but no (real) solution yet. Yes, I read the documentation, but this behaviour is not documented. If it is by design, it should be documented. If not, it should be fixed.

jack.slocum
4 Oct 2007, 3:22 AM
As the docs say, you MUST provide a size for the grid. If you don't it will assume autoHeight.

No height provided == autoHeight

However, if you want it to fit and size correctly in a BorderLayout use a GridPanel and Ext manages it for you.

timo.nuros
4 Oct 2007, 3:29 AM
Jack,

I did use a GridPanel, and it didn't work. I forgot this in my bug report, I'm sorry. Again, this seems only to happen in nested Layouts.

The issue remains. Is it correct that I cannot set a height if GridPanel is used? If no, seems that the height config value gets lost somehow.

regards,
Timo