Search code examples
javascriptextjstabpanelbuttongroup

ExtJS 3.4: Render buttons in hidden tabpanel


In ExtJs 3.4 I have a TabPanel with two tabs, the second tab contains a FormPanel, what contains a ButtonGroup. If the second tab is active, when I load the page, then everything is good, but when the first tab is active and I switch to the second, then there is no button in the button group, just the label. Here is the code:

var tabs = new Ext.TabPanel({
    renderTo: 'tabs',
    width:500,
    forceLayout: true,
    activeTab: 0,
    deferredRender: false,
    defaults:{autoHeight: true},
    items:[
        {contentEl:'tab1', title: 'Tab1'},
        {contentEl:'tab2', title: 'Tab2'}
    ]
});

var form = new Ext.form.FormPanel({
    width   : 400,
    autoHeight: true,
    renderTo: 'form',
    bodyStyle: 'padding: 5px',
    items: [
        {
            xtype: 'buttongroup',
            fieldLabel: 'Label',
            items: 
            [
                {
                    xtype: 'button',
                    text: 'Find By User',
                    width: 100,
                    scope: this,
                    handler: this.handleFind
                },
                {
                    xtype: 'button',
                    text: 'Find All',
                    width: 100,
                    scope: this,
                    handler: this.handleFindAll
                }
            ]
        }
    ]
});

I set the deferredRender: false and forceLayout: true, also tried the hideMode: 'offsets', but these didn't help.


Solution

  • Well, I add the hideMode: 'offsets' to the defaults of the TabPanel and it works fine. I did the same a few years ago without significant result.