Setting tabGroup.setActiveTab(2) doesn't work in app.js (1.2.0)
Hi
Even with the latest mobile SDK 1.2.0,
Setting the tabGroup.setActiveTab(2) still does not open the tab page on startup.
Anyone got a work-around?
6 Answers
-
The reason it doesn't work for anyone and not for me until tonight is the missing declaration in the top of the code.
var win = Titanium.UI.currentWindow;
var tabGroup = win.tabGroup;If you don't add the var tabGroup nothing will happen and no tab will get selected.
Happy coding.
-
I use:
tabGroup.activeTab = tab_objectWith tab_object of course being the object name of the specific tab I want to go to.
-
This bug was fixed in TI 1.2.1 I think, and I currently use the following to set an active tab based on an option dialog selection (e.index)
tabGroupLogin.open({ activeTab:e.index });
If for whatever reason this isn't working for you, you could try:
tabGroupLogin.setActiveTab(e.index);
I hope that works, it most definitely is working for me.
-
Providing the tab object as the parameter to
setActiveTab()
– instead of its index – solved this issue for me.tabGroup.setActiveTab(tabGroup.tabs[tabNum]);
-
tabGroup.activeTab = tab2;
doesn't quite work for me. Still it goes to the first tab page.
No errors but just refuse to go to the other tab windows except the first one. -
Nothing of what has been said here works on app.js.