How to create / destroy tab dynamically in sencha touch 2

I have a list of tabs that I want, when I switch the tab, the elements are added to the tab and redrawn, and the old tab is destroyed. I do this for performance reasons.

This is how I tried to do it, but its not working

view=    Ext.Viewport.add({                
                xtype : 'tabpanel',  
                deferredRender:false,
                tabBarPosition : 'bottom',
                items : tabs,
                listeners : 
                {
                    activeitemchange : function(container, newValue, oldValue,opts)
                    {
                        // --> destroy old tab
                        oldValue.setItems([]);
                        index = container.items.findIndex('id',newValue.id);
                        // --> redraw new tab                            
                        newValue.add(tabItems[index-1]);
                    }
                }
});

Tabs are loaded only for the first time. The second time I enter the tab that I get Error failed: NOT_FOUND_ERR: DOM 8 exception

What is the right way to do this?
And it really is more productive than creating tabs with their elements in them.

thank

+3
source share
1 answer

, . , . , ?

, - ? , tabpanel, , tabbar. , , ( ) , 1/2.

+2

All Articles