Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked April 7th 2010 by Peter Lum
  • app.js
  • startup
  • tabgroup.setactivetab
0 Comments

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.

    — answered May 8th 2010 by Andreas Kviby
    permalink
    0 Comments
  • I use:
    tabGroup.activeTab = tab_object

    With tab_object of course being the object name of the specific tab I want to go to.

    — answered April 7th 2010 by David Fox
    permalink
    0 Comments
  • 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.

    — answered July 7th 2010 by Andrew Gioia
    permalink
    0 Comments
  • Providing the tab object as the parameter to setActiveTab() – instead of its index – solved this issue for me.

    tabGroup.setActiveTab(tabGroup.tabs[tabNum]);
    
    — answered March 27th 2011 by Jeff Schuler
    permalink
    0 Comments
  • 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.

    — answered April 7th 2010 by Peter Lum
    permalink
    0 Comments
  • Nothing of what has been said here works on app.js.

    — answered July 7th 2010 by Pedro B.
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.