What am I doing wrong?
I've spent way too much time on this … I know I'm missing something very simple … I am trying to open a window when the user clicks on an entry in a tableView … I can't see or seem to open the window …
4 Answers
-
Accepted Answer
OK, so this is easy to see how you could miss this.
The problem is that you're using
Titanium.UI.currentTab
inapp.js
. You can only useTitanium.UI.currentTab
in the context of another opened window (called a sub-context) opened within a window with a url.So, for your example, just change
Titanium.UI.currentTab
totab1
.I realize this probably isn't intuitive initially. This special property is meant to give you a handle to the tab that you're parented to when opened inside a window.
For example, if you did:
var win = Ti.UI.createWindow({url:"foo.js"}); tab1.open(win);
then inside
foo.js
you'd be able to open another window in the tab:var win = Ti.UI.createWindow({url:"bar.js"}); Titanium.UI.currentTab.open(win);
Hope that helps clarify.
-
Hi there,
What might be an issue is adding the tableView to the window before setting the event listener. Once your code reaches line 15 it'll send objects to the screen.
Try moving the click event function up to between 7 and 8.
I find it easiest to keep event listeners right next to their creation commands, unless some other logic (mode) changes their behavior.cheers,
Chris. -
Chris, I think you've just solved a problem of my that has troubled me for many days. Could you please explain more in detail about the 15 line issue?
-
Chris … Thanks for your quick response … But that didn't do it :(