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 group woes with windows created using url *.js

Is it possible yet to utilize navigation groups beyond one level deep when the window hierarchy is created using separate *.js contexts for each window?

According to this post it was a known problem 6 months ago: http://developer.appcelerator.com/question/35481/createnavigationgroup

I can't find any reference to that in the open or closed tickets, so I can't find what version (if any) where it was fixed. Except Jeff Haynie claimed on June 16 that it should work with url now as well. See the comments at the end of http://developer.appcelerator.com/blog/2010/06/how-to-create-an-iphone-navigation-group.html

As Jeff certainly should know what he is talking about, I presumed it was fixed even if I could not find the ticket and tried to implement it. But I am having trouble making it work right.

So perhaps I am just doing it wrong. All the examples I can find, including the kitchen sink, only use windows in the same context which are created without the url property.

Can anyone provide a link to an example source which uses external url *.js context windows in combination with a navigation group?

— asked November 19th 2010 by Doug Handy
  • externalurl
  • mobile
  • navi
  • navigationgroup

3 Answers

  • I have posted a complete solution using NavigationGroups here


    — answered November 20th 2010 by Aaron Saunders
    1 Comment
    • Aaron - thanks for the sample code. On detail_window1.js I added code to create a TableView and added the TableView to currWindow. However, the view does not show up. If I add a button as in your example, it does show up. Any ideas?

      — commented July 14th 2011 by Avi
  • Aaron,

    Thanks much for the sample code. While I had tried passing an object reference to the navgroup as a window property, I had not also tried passing the parent and root windows as objects.

    As you note, popping back to the root controller is not pretty. In order to make it more dynamic regardless of the sequence of windows used to navigate to a given window, I made the following tweaks:

    In app.js around line 29 when assigning properties to the first window beyond the root, I added another property:

    level: 1,

    Then each time I need to open another window, for example near line 10 in your detail_window1.js, I use this:

    level: Ti.UI.currentWindow.level + 1,

    By tracking the nesting level, I can at any time pop back to the root using this code:

    btnHome.addEventListener('click', function(data)
        nextWindow = Ti.UI.currentWindow.parent;
        for ( i = 1; i < Ti.UI.currentWindow.level; i++ ) {
            closeWindow = nextWindow;
            nextWindow  = nextWindow.parent;

    That makes a standard way to drop a button on any form and be able to "go home" without worrying about the nesting involved. It essentially closes each parent window except the first, then finally closes the visible window returning you to the root controller.

    Thanks for the ideas!

    — answered November 20th 2010 by Doug Handy
    1 Comment
    • glad to be able to assist, it helps me get more comfortable with the framework

      — commented November 20th 2010 by Aaron Saunders
  • Aaron,

    I have another question. When I run your project in the OS 4.1 simulator, when I advance to test window two, the console show this error in red:

    [ERROR] Value was not the value expected. (containsChild) was not (YES) in- [TIViewProxy childWillResize) (TIViewProxy.m:1194)

    I get this whether I use Titanium SDK 4.1.1, 4.2, 4.3, or 1.5.0 – do you know what causes this? Your project continues, but I am seeing the same error in another project of mine which aborts, and I could not find the cause. But now I am not sure it is directly related to what makes my project fail.

    Do you know what causes this error in your project? Is this just an assertion they are testing in the TIViewProxy module? Is it safe to ignore it?

    Thanks again.

    — answered November 20th 2010 by Doug Handy
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.