'The code I've written utilizes MyHTTPlink to retrieve information such as Restaurant Name, url, and address. Currently, it lists all restaurant names and urls in a table. Now, I want to figure out how to send the details of a table row to the next window (.js page). Each restaurant's URL contains a list of menu items which I would like to display in a table row on the next page. How should I approach coding this?'.
var win = Titanium.UI.createWindow ({ backgorundColor: '#000'});
var tableview = Ti.UI.createTableView({
height:'auto',
layout:'vertical',
top:5,
right:5,
bottom:5, left:5 });
var data = [];
var xhr = Ti.Network.createHTTPClient ({
onload: function () {
alert("success!");
var json = JSON.parse(this.responseText);
for (var i = 0; i < json.connectionResponses.length; i++) {
var row = Ti.UI.createTableViewRow({
height: 60,
});
var restLabel = Ti.UI.createLabel({
text: json.connectionResponses[i].restaurantName,
height: 'auto',
left:54,
top: 5,
font:{ fontSize:20 }
});
var connLabel = Ti.UI.createLabel({
text: json.connectionResponses[i].connectingurl,
height: 'auto',
left:54,
bottom:5,
font:{ fontSize:14 }
});
var image = Titanium.UI.createImageView({
image:'images/menu_icon.png',
top:4,
left:0,
height:45,
width:41
});
row.add(restLabel);
row.add(connLabel);
row.add(image);
data.push(row);
}
tableview.setData(data);
},
onerror: function () {
alert('There was an error retrieving the remote data. Try again.');
}
//timeout:5000
});
xhr.open("GET", "http:MYHTTPlink");
xhr.send();
tableview.addEventListener('click',function(e){
//alert("RS Name : " +e.row.title);
var winn = Ti.UI.createWindow({ url:'hotelpage.js'});
winn.open();
//var hostelwin = require('hotelpage').gethotelWin;
//var newwin = new hotelwin();
//newwin.open();
});
win.add(tableview);
win.open();