View Full Version : Ext.tab.Panel - tab click event

20 Jul 2012, 6:38 AM

I am looking for a way to capture a click event on a tab that is already selected. I have an item named "Parts" and it is has been selected already. I want to be able to click it a second time and fire the same event.


20 Jul 2012, 7:37 AM
I have not found a good way of doing this documented in the Sencha forums. A workaround that I use is to add a 'tap' listener to the tab panel itself and specify the tab as the delegate like so:

// in the tab panel definition/configuration
listeners: {
delegate : 'tabbar > tab',
tap: function(tab) {...}

Of course in your definition of tap, you'll have to call whatever function the 'Parts' panel calls when it initially displays. You can access the actual active panel by doing something like this in 'tap'

tap: function(selectedTab) {
var activePanel = this.up('tabpanel').getActiveItem();

then, assuming you set up your controller to listen for the appropriate events each panel fires, you can do the following (I made up 'partsPanelEventName' for the sake of demonstration and eventParameters is optional)

activePanel.fireEvent('partsPanelEventName', eventParameters);