Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    59
    Vote Rating
    3
    wsi is on a distinguished road

      0  

    Default [4.2.0.179] Resized window does not properly shrinkWrap a collapsible panel

    [4.2.0.179] Resized window does not properly shrinkWrap a collapsible panel


    REQUIRED INFORMATION
    Ext version tested:
    • Ext 4.2.0.179
    Browser:
    • Chrome 24.0.1312.57 m
    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

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,018
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1