Titanium Community Questions & Answer Archive

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

Ti.UI.currentNav ... is there such a method?

I am pretty new to Titanium. I am building an app where I do not want to see the tab bar at the bottom, and will be handling all navigation through buttons on screen. So, instead of using tabGroups, I decided to use navGroups.

On my main screen, I have a few buttons. Clicking a button opens a nav page containing a table view. The problem I am having is getting the table view to open another navPage. In other words, page 1 button –> page 2 (containing a tableView) –> page 3. The issue I had using navGroups was I was unable to access the navGroup to open another window.

After spending 2 days trying to get this to work, I created a test project using tabGroups instead, and just hiding the tabBar. All works fine now. I can use Ti.UI.currentTab.open() to open page 3.

My question is this: is there an equivalent to Ti.UI.currentTab, but for navGroups? And if not, should I have used tabGroups all along?

Sorry for the lengthy discussion… kinda hard to explain.

— asked November 20th 2010 by Brian Hunkins
  • currenttab
  • navgroup
  • tabgroup

2 Answers

  • I know you have switched to tabs but to open up multiple windows with a navGroup, this is what I do


    Just give the view the new window to open and thats it

    — answered November 20th 2010 by Aaron Saunders
    • didn't seem to work. The navGroup is defined in app.js. Also in app.js is an include to setup.js. Setup.js creates all the buttons, windows, and listeners. The window's url's are associated to other .js files as well. It is in those other .js files where I need to open a new navGroup page. I think the reason why I can't work with the navGroup at this level is it is out of scope.

      Anyway, where would I add the prototype method? I tried it in one of the misc.js files, where I want the next nav page to open. I get an error: message = "Can't find variable: App";

      I still have my app built with a navGroup, so am holding out to find a working solution. Otherwise I'm gonna have to convert it over to use tabGroups.

      — commented November 20th 2010 by Brian Hunkins
    • what i do is pass the navGroup around when I open a new window… I will try and type up a simple demo with multiple js files

      — commented November 20th 2010 by Aaron Saunders
  • I have posted a complete solution using NavigationGroups here


    — answered November 20th 2010 by Aaron Saunders
    1 Comment
    • that helped a lot! Looking through your code I discovered you can set your own properties for windows. Didn't know you could do that! I passed the navGroup to the window and all worked well! Thanks again!

      Is this a good way to do this, using navGroups? Or would using tabGroups have been a better way?

      — commented November 20th 2010 by Brian Hunkins
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.