Search code examples
extjs3tabpanelcardlayout

extjs 3 - card layout doesn't work in tabpanel


I am using tabpanel with card layout. When i open the tab for the first time everything works fine. but when i close (hide) the tab and then reopen it then i can no longer navigate between cards

// Hide tab
tab.hide();
tabpanel.hideTabStripItem(tab);

// Reopen tab
tabpanel.unhideTabStripItem('mytab');
tabpanel.setActiveTab('mytab');

// Panel = objPanel
{
    xtype: 'panel',
    layout: 'card',
    layoutConfig: {
        deferredRender: true
    },
    activeItem: 0,
    border: false,
    plain: true,
    items: [
        ...
    ]
}

// Switching between cards
objPanel.getLayout().setActiveItem(0);   // or 1

The thing is objPanel.getLayout() gives "card" (string) after reopening the tab instead of an object.

Can anyone suggest any solution for this? Thanks for any help.


Solution

  • I am not sure what causes this problem but when i changed dataview to gridpanel, everything is working fine.

    Following is how my layout was - when i wasn't able to reopen a tab:

    form panel
        displayfield
        panel with card layout
            dataview 1 - card 0
            dataview 2 - card 1
    

    New layout - where i am able to reopen the tab:

    form panel
        displayfield
        panel with card layout
            grid - card 0
            dataview 2 - card 1