Titanium Community Questions & Answer Archive

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

Click a Row Open a Web View

OK, I'm pulling my hair out…please let me know what I'm missing…

I want to click the row and then open the whole post in a webview. Basically load the url of the "full content" from the JSON feed. BUT, I can't get this to get anything but the last row that was added. TIA!

            // Add the post view to the row
            // Give each row a class name
            row.className = "item"+i;
            // Add row to the rowData array
            rowData[i] = row;
        // Create the table view and set its data source to "rowData" array
        var tableView = Titanium.UI.createTableView({data:rowData});
        //Add the table view to the window

    ///CLICK ON ROW, OPEN URL associated with the JSON record to a webview.

        tableView.addEventListener('click',function(e) {
            var newsPage = Ti.UI.createWindow({title:user});
 /////HOW do I get this to use the row that I click on for the right URL?   
          var wb = Ti.UI.createWebView({url:e.row.avatar});  
— asked November 22nd 2010 by Mark Smillie
1 Comment
  • Mark

    Where is "i" defined? I don't think you have included the loop. Please would you post all the relevant parts of your code?

    By the way, className should have the same value for every row that has the same layout, whereas you have assigned a different value to each, ie "item"+i

    — commented November 22nd 2010 by Paul Dowsett

0 Answers

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.