1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    6
    Vote Rating
    0
    sand1980 is on a distinguished road

      0  

    Default Unanswered: Control in a collapsible panel resizes itself and goes out of layout

    Unanswered: Control in a collapsible panel resizes itself and goes out of layout


    Hi there,
    I have the following code.
    Code:
    var items = [{
        items: [{
            title: 'Description',
            xtype: 'fieldset',
            items: [{ xtype: 'textarea', hideLabel: true, height: 100, name: 'Description', itemId: 'description'}]
        }]}, {
        items: [{
            title: 'Comment',
            xtype: 'fieldset',
            items: [{ xtype: 'textarea', id: 'CommentArea', hideLabel: true, height: 40, anchor: '100%', name: 'Comments'}]
        }]
    }];
    
    
    var formPanel = Ext.create('Ext.FormPanel', {
        region: 'center',
        split: true,
        layout: 'column',
        autoScroll: true,
        floatable: false,
        animCollapse: true,
        border: false,                
        height: 600,
        anchor: '100%',
        defaults: {
            border: false,
            layout: 'form',
            columnWidth: 0.50,
            bodyStyle: 'padding:5px 5px 0 5px',                
            defaults: {
                anchor: '-20',
                xtype: 'textfield'
            }
        },
        items: items
    });
    var panel = Ext.create('Ext.Panel',  {
        title: 'General Info',
        layout: 'border',
        autoScroll: false,
        isReadOnly: false,
        collapsible: true,
        border: false,
        height: 605,
        items: [formPanel]
    });
    var win = Ext.create('Ext.window.Window',{
        title: 'Test window',
        height: 500,
        width: 700,
        layout: 'fit',
        items: panel,
        x: 25, y:25
    });
    win.show();
    When click on the collapsible panel and minimized it and then again click it to maximize it the controls resize itself and go out of layout and get chopped off. You can view screenshot of it below.
    CollapsiblePanelResizeIssue.jpg
    I have a similar kind of issue in another app but due to company policy I cannot share the code. I think the layout problem there is related to this. Is there any solution?

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,941
    Answers
    460
    Vote Rating
    635
    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


    It's probably better if you explain what output you want, because there's a few abuses/misuses of the layout system, in no particular order:

    1) The window has a fit layout, so there's no point specifying a height/width on "panel".
    2) A border layout with a single child item, fit would be more appropriate.
    3) Why nest a form panel inside a panel? This is over-nesting.
    4) Anchor is redundant on the form config, since the parent doesn't use an anchor layout.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    6
    Vote Rating
    0
    sand1980 is on a distinguished road

      0  

    Default


    Thank Evan.
    I am porting an ExtJS 3 app to ExtJS4. In the existing application the UI is similar to the code I have shared above.
    I tried your solution but the same problem persist. The code with your changes is pasted below.
    Code:
    var items = [{
    	items: [{
    		title: 'Description',
    		xtype: 'fieldset',
    		items: [{ xtype: 'textarea', hideLabel: true, height: 100, name: 'Description', itemId: 'description'}]
    	}]}, {
    	items: [{
    		title: 'Comment',
    		xtype: 'fieldset',
    		items: [{ xtype: 'textarea', id: 'CommentArea', hideLabel: true, height: 40, name: 'Comments'}]
    	}]
    }];
    
    
    var formPanel = Ext.create('Ext.FormPanel', {
    	collapsible: true,
    	split: true,
    	layout: 'column',
    	autoScroll: true,
    	floatable: false,
    	animCollapse: true,
    	border: false,	
    	defaults: {
    		border: false,
    		layout: 'form',
    		columnWidth: 0.50,
    		bodyStyle: 'padding:5px 5px 0 5px',                
    		defaults: {
    			anchor: '-20',
    			xtype: 'textfield'
    		}
    	},
    	items: items
    });
    
    
    var win = Ext.create('Ext.window.Window',{
        title: 'Test window',
        height: 500,
        width: 700,
        layout: 'fit',
        items: formPanel,
        x: 25, y:25
    });
    win.show();

Thread Participants: 1

Tags for this Thread