PDA

View Full Version : AutoHeight and browser resize



Chau
9 Nov 2009, 8:40 AM
Hi.

Now I'm too tired looking at this problem, so I am turning to you in hope of a solution. I have a simple panel inside a border-layout.



var sourceInformation = new Ext.Panel({
title: "Information",
region: "south",
autoHeight: true,
border: true,
id: 'sourceInformationArea',
html: 'ID: 4534<br>Available: Yes<br>Status: n/a<br>'
});
I update the HTML contents in this panel when the user clicks some objects.


var newHTMLContent = "...";
Ext.getCmp('sourceInformationArea').body.update(newHTMLContent);
Since I have used autoHeight = true, I would expect it to resize to fit the new content. I am not sure about that, so I have tried doLayout(), syncSize(), setHeight(some arbitrary number), but the only thing that actually works, is manually using the mouse to resize the browser window.

What should I do to invoke an automatic resize of the panel?

Kind regards, Casper

smit_al
9 Nov 2009, 9:00 AM
Try


layout: 'fit'

Chau
9 Nov 2009, 9:09 AM
Try


layout: 'fit'

Sorry, but it didn't help (:|

hendricd
9 Nov 2009, 9:11 AM
Hi.

Now I'm too tired looking at this problem, so I am turning to you in hope of a solution. I have a simple panel inside a border-layout.



var sourceInformation = new Ext.Panel({
title: "Information",
region: "south",
autoHeight: true,
border: true,
id: 'sourceInformationArea',
html: 'ID: 4534<br>Available: Yes<br>Status: n/a<br>'
});
I update the HTML contents in this panel when the user clicks some objects.


var newHTMLContent = "...";
Ext.getCmp('sourceInformationArea').body.update(newHTMLContent);
Since I have used autoHeight = true, I would expect it to resize to fit the new content. I am not sure about that, so I have tried doLayout(), syncSize(), setHeight(some arbitrary number), but the only thing that actually works, is manually using the mouse to resize the browser window.

What should I do to invoke an automatic resize of the panel?

Kind regards, Casper

@Casper -- Although layouts do not act kindly to autoHeight, you'll need to tell the layout that something of interest (size-wise) has changed:



var newHTMLContent = "...";
var south = Ext.getCmp('sourceInformationArea');
if(south){
south.body.update(newHTMLContent);
south.ownerCt.doLayout();
}

Chau
9 Nov 2009, 9:15 AM
@Casper -- Although layouts do not act kindly to autoHeight, you'll need to tell the layout that something of interest (size-wise) has changed:



var newHTMLContent = "...";
var south = Ext.getCmp('sourceInformationArea');
if(south){
south.body.update(newHTMLContent);
south.ownerCt.doLayout();
}



hendricd - You are my hero and it seems to work like a charm. Thank you so much =D>