Open new window on button click
Hi,
I need to open a new window when a button click event is fired. Ti.UI.CurrentWindow is not working for me in the new_window.js
//onclik
Ti.API.info('event button clicked')
var eventWin = Ti.UI.createWindow({
url:'new_window.js',
title:'Events'
});
Ti.API.info('eventwin in app.js: ' + eventWin);
eventWin.open();
I'm getting an error at 0,0..
3 Answers
-
First of all use the syntax formatting. Your post is much easier to read.
Second:
var eventWin = Ti.UI.createWindow({ url:'new_window.js', title:'Events', modal: true }); Ti.API.info('eventwin in app.js: ' + eventWin); eventWin.open();
Try to add modal:true maybe this does the trick for you.
-
may i know what is the syntax followed in new_window.js
-
Ti.UI.currentWindow will not be available in your new window because it is out of context.
The reason is because you are opening a standalone window and not a window opened by a navigation controller (Tab Group or Navigation Group).
i.e. Ti.UI.currentWindow is only available to windows opened via a Tab/Navigation group.