How can I change the window and go back?
Hello,
Do you have an example? It's quite difficult to find sth. about this in the KitchenSink.
My attempt:
#app.js
var data = [
{title:'Drück mich!', hasChild:true, test:'window.js'}
];
var tableview = Titanium.UI.createTableView({
data:data
});
win1.add(tableview);
tableview.addEventListener('click', function(e){
win = Titanium.UI.createWindow({
url:e.rowData.test,
title:e.rowData.title,
backgroundColor:'#fff',
barColor:'#111'
});
});
#window.js
var win = Titanium.UI.currentWindow;
win.open()
So the TableView is built correctly, but when I click on the row nothing happens.
Thanks in advance!
2 Answers
-
This is what is working on my app
reportWindow = Titanium.UI.createWindow({ url: e.rowData.destination, title: "Report", backgroundColor: '#fff', barColor: '#111', reportData: e.rowData.reportData }); Titanium.UI.currentTab.open(reportWindow,{animated:true});
The piece of code should be inside your "click" event
-
I tried your code, but it didn't work. When I click on the TableView, nothing happens.
here's my code:
var tabGroup = Titanium.UI.createTabGroup(); var win1 = Titanium.UI.createWindow({ title:'Home', backgroundColor:'#fff' }); var tab1 = Titanium.UI.createTab({ title:'Home', window:win1 }); var win2 = Titanium.UI.createWindow({ title:'Meine Freunde', backgroundColor:'#fff' }); var tab2 = Titanium.UI.createTab({ title:'Freunde', window:win2 }); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.open(); var data = [ {title:'Drück mich!', hasChild:true, test:'window.js'} ]; var tableview = Titanium.UI.createTableView({ data:data }); win1.add(tableview); tableview.addEventListener('click', function(e){ reportWindow = Titanium.UI.createWindow({ url: e.rowData.test, title: "Report", backgroundColor: '#fff', barColor: '#111' // reportData: e.rowData.reportData }); Titanium.UI.currentTab.open(reportWindow,{animated:true}); });