Titanium Community Questions & Answer Archive

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

Navigation: how to return to home?

Hi guys, I'm in trouble with my app.
I have a single window with a dashboard. When I click on a icon I open a new window. Then another child win etc…

At the beginning I made a Navigation Group without Tabs Group as you can see on Developer Blog. The problem was to create and add dynamic children to the window.

So I made a tabgroup with a single tab and hidden tabbar. It's cool because I can use Titanium.UI.currentTab.open to add a child.

It's also a cool thing that, if you click on the tab button, you return to the "root" window. It's very usefull if you have a lot of children..

How can I simulate this behaviour? I added a button to the navbar of every window.. I would like that, when a user click this button, the app returns to the main tab window (same behaviour as tab button click).

Thanks a lot! Have a nice day,

— asked July 18th 2010 by Flavio Ferrandi
  • child
  • navigator
  • root
  • tabs
1 Comment
  • For anyone who doesn't post on StackOverflow (or a flavour thereof) always leave a comment if your going to downvote something so the original poster can do better next time :D

    — commented January 12th 2011 by Blake E

4 Answers

  • For tabgroups. I saved the tabgroup object back onto the Ti.UI object for later usage. When I want to switch tabs and go back to the home/root/initial window of the tab, I found the simplest way was to just close and reopen the tab group with activeTab set to the index you wanted. It's cheesy but seems to work. I would think the same method would work for navgroups as well.

    In the app.js file:

    // created an object called tabGroup that has already
    // been setup with all my tabs
    Ti.UI.tabGroup = tabGroup;

    In another js file for a tab:


    It works better than I thought it would actually. My screen doesn't seem to show the fact I just closed and opened the tabgroup.

    — answered January 28th 2011 by Audra M. King
    1 Comment
    • Does your solution works for Android too ?

      — commented July 18th 2012 by Umaid Saleem
  • I am having exactly the same issue, although I am switching from a different tab. The switch via setActiveTab is fine but … on a button click I want to send the user back to the first window in the drill. I too am using a tabgroup, which simulates the effect perfectly, if you click on the tabgroup button at the bottom of the app.

    Is there a fireEvent that can take place? I am already using setActiveTab() but that takes me to the drill at the level it was left.



    — answered August 24th 2010 by Tim Hall-Woodcock
  • My workaround for this problem when using a navigation group was simply re-open the root window for the nav group (and close the old one).

    — answered August 24th 2010 by John Lorance
  • What I do was let the main Window into a function, so when the user click on "Home" button, i just call home() function.

    — answered August 24th 2010 by Esteban Fernandez
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.