azaram
asked on
TabBar - enabling itemClick on the selected tab
Hey,
This should be fairly simple. I have a TabBar with an itemClick handler that controls a viewstack.
I'm using it for the primary navigation on an application.
Within the viewstack, the user can navigate further into child views, and I want them to be able to click the current tab to return to the root view for that tab as this is the natural choice.
However, the itemClick event is disabled on the selected tab in TabBar. I'm sure there is a simple option to re-enable it, but I can't find it. toggleOnClick would seem like an obvious candidate, but no joy.
This should be fairly simple. I have a TabBar with an itemClick handler that controls a viewstack.
I'm using it for the primary navigation on an application.
Within the viewstack, the user can navigate further into child views, and I want them to be able to click the current tab to return to the root view for that tab as this is the natural choice.
However, the itemClick event is disabled on the selected tab in TabBar. I'm sure there is a simple option to re-enable it, but I can't find it. toggleOnClick would seem like an obvious candidate, but no joy.
....
private function primaryTabsItemClickHandler(e:Object):void
{
if (e.index == 1 && businessGroups != null)
{
businessGroups.businessGroupViewStack.selectedIndex = 0;
}
primaryViewStack.selectedIndex = e.index;
}
....
<mx:TabBar id="primaryTabs" styleName="PrimaryTabs" tabStyleName="PrimaryTabsTab" itemClick="primaryTabsItemClickHandler(event)">
<mx:dataProvider>
<mx:Array>
<mx:String>MY TASKS</mx:String>
<mx:String>CHANNELS</mx:String>
<mx:String>MY TIMESHEETS</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:TabBar>
<mx:ViewStack id="primaryViewStack" width="100%" height="100%"
backgroundColor="#FFFFFF" borderSides="left,right,bottom" borderStyle="solid" paddingBottom="15" paddingLeft="15" paddingRight="15"
paddingTop="15">
.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the tips.
After some further consideration though, I've decided that it's better to run with a group of primary navigation buttons. I had considered breadcrumbs, but that doesn't solve the default use case of someone clicking a tab and expecting to see the root of its content.
Using buttons has allowed me to do something else I wanted to do - a shortcut menu of items relevant to the logged in user that drops down from one of the buttons in the form of a PopupButton.
After some further consideration though, I've decided that it's better to run with a group of primary navigation buttons. I had considered breadcrumbs, but that doesn't solve the default use case of someone clicking a tab and expecting to see the root of its content.
Using buttons has allowed me to do something else I wanted to do - a shortcut menu of items relevant to the logged in user that drops down from one of the buttons in the form of a PopupButton.
Thanx 4 axxepting and good luck with it
ASKER
After some further consideration though, I've decided that it's better to run with a group of primary navigation buttons. I had considered breadcrumbs, but that doesn't solve the default use case of someone clicking a tab and expecting to see the root of its content.
Using buttons has allowed me to do something else I wanted to do - a shortcut menu of items relevant to the logged in user that drops down from one of the buttons in the form of a PopupButton.