Peter Bailey
Peter Bailey

Reputation: 105868

Breaking from default behavior of TabGroups and new windows

Typically, opening a window in a tab is pretty straighforward

Ti.UI.currentTab.open( 
    Ti.UI.createWindow( {url: 'foo.js'} )
  , {animated: true }
);

However, this initiates the "navigation group" style of UI breadcrumbs. A "back" button is automatically placed on the nav bar.

Is there any way to open a window, in the current tab, but start from a fresh history? Or make a "lateral" move to a new window - essentially replacing the current?

To make sure I'm clear, consider this window hierarchy

     root
    /    \
 child1  child2
        /      \
   child3      child4

In each case, a specific user action will open one of two windows into the current tab.

What if I wanted for a button click on child3 to open child4 while respecting the above view heirachy? I wouldn't want "back" to go to child3, I'd want it to go to child2. Like this

     root
    /    \
 child1  child2
        /      \
   child3----> child4

Or what if I wanted "back" to just be gone, effectively starting a new navigation history?

Upvotes: 1

Views: 341

Answers (2)

Dogweather
Dogweather

Reputation: 16769

I've noticed that this child3 --> child4 behavior is very similar to what I get in a window which is predominantly displaying a web view with a local HTML document, and the HTML has a hyper link to another local HTML document.

Upvotes: 0

gerry3
gerry3

Reputation: 21460

I think you can accomplish the "lateral" move by doing a non-animated close, followed by an open:

Ti.UI.currentTab.close( 
    child3
  , { animated: false }
);

Ti.UI.currentTab.open( 
    child4
  , { animated: true }
);

However, I do not think you can do this on the root window in order to start from a "fresh history".

Upvotes: 1

Related Questions