PDA

View Full Version : deselect event for tabitem



bhomass
13 Jan 2010, 7:24 PM
any one found a way to detect when a tabitem is de-selected?

I tried using OnBlur and Deativate. neither worked.

I did add event sink too!.

Arno.Nyhm
15 Jan 2010, 10:04 AM
http://www.extjs.com/forum/showthread.php?p=415209#post415209

bhomass
15 Jan 2010, 12:32 PM
Thanks for the pointer, but this substitution does not do the job.

there are too many "other" tab items to monitor to detect the current tab item.

for example, I have multiple two-tier tab panels. any one of the "other" tab items in any one peer tab item and their descendant tab items would have to report the last selected tab in order to identify it. detection using beforeselect is just not practical.

is there a way to implement what I am referring to using some sub classing technique?

terciofilho
16 Jan 2010, 9:01 AM
I think that the only "secure" way is to:



tabPanel.addListener(Events.Add, new Listener<TabPanelEvent>()
{
public void handleEvent(final TabPanelEvent te)
{
final TabItem tabItem = te.getItem();
tabItem.addListener(Events.BeforeSelect, new Listener<BaseEvent>()
{
public void handleEvent(final BaseEvent be)
{
// Fire an Event with this item, as the Deselected one.
tabPanel.getSelectedItem();
}
});
}
});



This will add an Listener to every tab that this Tab Panel add, so before a tab is selected, you get the selected one and fire an event that it will be deselected.

Hope it helps.