Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Ext JS Premium Member
[4.2.0.179] Resized window does not properly shrinkWrap a collapsible panel
REQUIRED INFORMATION
Ext version tested:
Browser:
Description:
- When a panel is collapsed, the window containing it shrinks to fit the collapsed panel. After resizing the window, it no longer shrinkwraps its contents.
Steps to reproduce the problem:
- Create a collapsible panel.
- Create a window which contains the collapsible panel.
- Resize the window.
- Collapse the panel.
The result that was expected:
- The window should shrinkwrap the panel.
The result that occurs instead:
- The window remains the same size.
Test Case:
Code:
var panel = Ext.create('Ext.panel.Panel', {
collapsible: true,
width: 200,
height: 200
});
var window = Ext.create( 'Ext.window.Window', {
layout: "fit",
renderTo: Ext.getBody()
});
window.add( panel );
window.show();
Workaround:
Put listeners on the collapse and expand and resize the window explicitly.
Code:
var panel = Ext.create('Ext.panel.Panel', {
collapsible: true,
width: 200,
height: 200
});
var window = Ext.create( 'Ext.window.Window', {
layout: "fit",
renderTo: Ext.getBody()
});
window.add( panel );
window.show();
panel.on( 'collapse', function() {
window.setHeight( 56 );
});
panel.on( 'expand', function() {
window.setHeight( 200 );
});
However, this lead to another bug if animCollapse is set to false for the panel. The window.setHeight call would cause a javascript error in this case:
Uncaught TypeError: Cannot read property 'length' of undefined
Last edited by wsi; 7 Feb 2013 at 2:33 PM.
Reason: Workaround
-
This is the expected behaviour. By resizing the window, you're giving it explicit dimensions, which means it will no longer wrap around the contents.
Twitter - @evantrimboli
Former Sencha framework engineer, available for consulting.
As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.