View Full Version : tabpanel click only create view page

15 Jun 2013, 3:08 AM
hi every one,

how to view create and destroy on tab panel click.

my requirement is if 3 tab panels is there TAB1 TAB2 TAB3.

IF i am click on TAB1 only create TAB1 view AND if i am click on TAB2 TAB1 view is destroyed and create TAB2 view created ...... this process repeated every tab.
and one more important point is if i am destroy view it is removed from dom

16 Jun 2013, 11:26 PM
To clarify, you're wanting a tabpanel with three tabs and when you click on a given tab its contents are created and all other rendered tabs' content is destroyed until you click on its tab again?

17 Jun 2013, 3:02 AM
yes ,it is correct . can i do that ? , please give me the example

17 Jun 2013, 3:08 AM
You can do a kind of lazy loading, and load only the tabs the user activate.
To do that, try the panel's activate event http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.panel.Panel-event-activate

17 Jun 2013, 12:54 PM
I'm not sure how you'll destroy the tabs that aren't visible without destroying the tab, too. If the tabs are panels with items in them you could do a removeAll() on the tab once it is no longer the active tab I suppose.

Out of curiosity, why are you wanting to destroy the content in the tab once the user focuses on a different tab?