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.
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.
-
probably can go for this:
tabGroup.activeTab.open(win,{animated:true});
well, tabGroup need to be defined earlier…
-
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. :/
-
currentTab is not documented, but it is working now. I believe it is not available in app.js.