Results 1 to 6 of 6

Thread: FormPanel with column layout on CardLayout problem

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    99

    Default FormPanel with column layout on CardLayout problem

    Hi,

    I have a problem with following setup on Firefox and Chrome. Fieldsets and the parent div with class x-column-inner do not get style="width: WHATEVERpx;" at all. But if I change activeItem to 1 on config then everything is rendered correctly. Internet Explorer works correctly on both cases and sets width style.

    So is there something wrong in my code or is this a bug in ExtJS?

    PHP Code:
    var searchPanel = new Ext.form.FormPanel({
        
    id'searchPanel',
        
    width800,
        
    frametrue,
        
    title'Search',
        
    layout'column',
        
    defaults: {
            
    layout'form',
            
    borderfalse,
            
    bodyStyle'padding:4px;'

        
    },

        
    items: [
            {
                
    xtype'fieldset',
                
    columnWidth:0.5,
                
    autoHeighttrue,
                
    defaults: {
                    
    anchor'-20'

                
    },
                
    items: [

                    {
                        
    xtype'textfield',
                        
    id'field1',
                        
    fieldLabel'Field 1',
                        
    msgTarget'side',
                        
    width150
                    
    }


                ]

            },
            {
                
    xtype'fieldset',
                
    columnWidth:0.5,
                
    autoHeighttrue,
                
    defaults: {
                    
    anchor'-20'
                
    },
                
    items: [
                    {
                        
    xtype'textfield',
                        
    id'field2',
                        
    fieldLabel'Field 2',
                        
    msgTarget'side',
                        
    width150
                    
    }


                ]

            }
        ]
    });


    Ext.onReady(function() {
        var 
    viewPort = new Ext.Viewport({
            
    layout'border',
            
    items: [
                {
                    
    region'north',
                    
    html'<h1 class="x-panel-header">Test</h1>',

                    
    autoHeighttrue,
                    
    borderfalse,
                    
    margins'0 0 5 0'
                
    },
                {
                    
    region'center',
                    
    xtype'container',
                    
    id'myCardPanel',
                    
    layout'card',
                    
    framefalse,
                    
    layoutOnCardChangetrue,
                    
    deferredRenderfalse,
                    
    activeItem0,
                   
                    
    items: [
                        {


                            
    xtype'container',
                            
    borderfalse,
                            
    margins'5 5 5 5',

                            
    items: [
                                {
                                    
    xtype'button',
                                    
    text'Change card',
                                    
    handler: function() {
                                        var 
    cp Ext.getCmp('myCardPanel');
                                        
    cp.getLayout().setActiveItem(1);
                                    }
                                }
                            ]


                        },
                        {
                            
    xtype'container',
                            
    layout'vbox',


                            
    items: [searchPanel]




                        }
                    ]
                }
            ]
        });

    }); 

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    When hidden using style display:none, the searchPanel's element reports zero width.

    Configure it hideMode: 'offsets'.

    And if you are strictly allocating the available width of the panel, best use "hbox" layout. Then you also get other nice configs like stretch and align if you need them.

  3. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    And this is an overnest:

    Code:
    { 
                            xtype: 'container', 
                            layout: 'vbox', 
    
    
                            items: [searchPanel] 
    
    
    
    
                        }
    Just put the searchPanel in there. No need to wrap it in an extra layer of containment.

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    99

    Default

    Quote Originally Posted by Animal View Post
    When hidden using style display:none, the searchPanel's element reports zero width.

    Configure it hideMode: 'offsets'.
    Thanks, but I added the hideMode: 'offsets' to FormPanel's config but it didn't help. Still no widths on Firefox and Chrome. Internet Explorer working correctly all the time.

    The overnesting was a leftover of making a test case. In real code I have also GridPanel below the FormPanel.

  5. #5
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    It's:
    Code:
    layoutConfig: {
      layoutOnCardChange: true,
      deferredRender: false
    }

  6. #6
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    99

    Default

    Quote Originally Posted by Condor View Post
    It's:
    Code:
    layoutConfig: {
      layoutOnCardChange: true,
      deferredRender: false
    }
    Thanks a lot Condor, that fixed the problem. Funny it worked all the time on IE, any idea why?

Similar Threads

  1. Replies: 15
    Last Post: 18 Jun 2010, 4:53 AM
  2. FormPanel with column layout problem
    By jeusdi in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 7 Jan 2009, 11:06 PM
  3. Replies: 4
    Last Post: 16 Oct 2008, 10:00 PM
  4. [SOLVED] Problem with CardLayout and FormPanel
    By void0 in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 23 Jan 2008, 5:23 AM
  5. Problem with FormPanel in column layout
    By fidget in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 30 Nov 2007, 9:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •