Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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});
}
});

— asked July 14th 2010 by Sean DeChellis
  • external
  • tableview
  • url
  • webview
0 Comments

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}); 
            } 
    
            });
    
    — answered July 19th 2011 by Richard Lustemberg
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.