Titanium Community Questions & Answer Archive

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

Cannot find documentation to use Titanium.UI.currentTab

Throughout KitchenSink new js files are loaded onto the screen using the line

Titanium.UI.currentTab.open(win,{animated:true});

I cannot find the function Titanium.UI.currentTab anywhere in the API and actually got "Search Results for: Titanium.UI.currentTab No results found. Please refine your search term(s)." when I searched the mobile API.

I've copied the code directly from KitchenSink but get the error

message = "Result of expression 'Titanium.UI.currentTab' [undefined] is not an object.";

My exact code block is:

// create table view event listener
tableview.addEventListener('click', function(e)
{
    if (e.rowData.jsURL)
    {
        var win = Titanium.UI.createWindow({
            url:e.rowData.jsURL,
            title:e.rowData.title
        });
        Titanium.UI.currentTab.open(win,{animated:true});
    }
});

I would like to not only get this code working and opening a tab which runs the js from another js file, but also I'd like to understand how this method is supposed to work. Without working sample code, and any documentation, I'm stumped.

— asked March 31st 2011 by Matt Propst
  • iphone
  • mobile
  • titanium.ui
0 Comments

4 Answers

  • Ti.UI.currentTab is just a reference to the current tab so any method you can call on a tab can be called on the current tab, Same goes for currentWindow. Assuming you are using a tabGroup that code should work as you think it would. Otherwise you would need to replace currentTab with currentWindow.

    for docs on tab

    — answered March 31st 2011 by Mr triux
    permalink
    0 Comments
  • probably can go for this:

    tabGroup.activeTab.open(win,{animated:true});

    well, tabGroup need to be defined earlier…

    — answered April 28th 2011 by Lim Yan
    permalink
    0 Comments
  • Same problem: http://developer.appcelerator.com/question/98501/titaniumuicurrenttab-is-null

    The workaround actually works. Seems like Ti.UI.currentTab is not working as intended. :/

    — answered April 7th 2011 by Paul Voss
    permalink
    0 Comments
  • currentTab is not documented, but it is working now. I believe it is not available in app.js.

    — answered April 7th 2011 by Aaron Saunders
    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.