External URL - Webview Assistance
I am working with a tableview and am trying to use the following code to incorporate a webview when clicked but nothing happens when I test it. Any suggestions?
{title:'Student Tickets Login',backgroundImage:'images/tableview/off_3.png', hasChild:true, url:'https://oss.ticketmaster.com/html/home.htmI?SPSID=0&SPID=2996&&DB_OEM_ID=7700&team=usf&l=EN&STAGE=1&CNTX=10477925&out=1',
selectedBackgroundImage:'images/tableview/on_3.png', leftImage: 'images/tableview/phone_photogallery.png'}
my event listener is as follows:
tableView.addEventListener('click', function(e)
{
if (e.rowData.test)
{
var win = Titanium.UI.createWindow({
url:e.rowData.test,
title:e.rowData.title
});
Titanium.UI.currentTab.open(win,{animated:true});
}
});
1 Answer
-
I've just noticed the question was asked long ago. Never mind, I'll post the code example anyway. You are forgetting to add the webview, which will accept an external url as a parameter. After you created the window, you create a webview, add it to the window and then open the window.
{title:'Student Tickets Login',backgroundImage:'images/tableview/off_3.png', hasChild:true, url:'https://oss.ticketmaster.com/html/home.htmI?SPSID=0&SPID=2996&&DB_OEM_ID=7700&team=usf&l=EN&STAGE=1&CNTX=10477925&out=1', selectedBackgroundImage:'images/tableview/on_3.png', leftImage: 'images/tableview/phone_photogallery.png'} tableView.addEventListener('click', function(e) { if (e.rowData.url) { var win = Titanium.UI.createWindow({title:e.rowData.title }); var webView=Titanium.UI.createWebview({url:e.rowData.url}); win.add(webView); Titanium.UI.currentTab.open(win,{animated:true}); } });