Titanium Community Questions & Answer Archive

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

webview inside tableview row not clickable!

i've created a tableViewRow inside a tableView and i've added a webview holding a youtube embed html. i've installed the app on my iphone and when trying to tap the youtube video 'play' graphic that is generated, it just selects the row and i'm unable to launch the youtube video from the embedded webview.

help kevin whinnery !!!! ( or anyone else too!! )

rocksteady,
danno~

— asked May 11th 2010 by danno watts
  • iphone
  • tableview
  • webview
  • youtube
0 Comments

10 Answers

  • "In fact that window with my scrollView is opened 'from' a tableView list of 'stuff'"

    exactly how i'm doing it too.
    well instead of waiting for 1.3 to allow for tableViewRow's to let someone load a youtube video from inside of the row itself, i just created a scrollView and essentially mimicked a tableView with the information i had. and what do ya know, it works just fine :)

    thanks again for your help, it's awesome that you got back to me. the last few questions i asked a solution hadn't been found ( or even worse, nothing had been suggested at all!) and it feels good to have a solution here :)

    rocksteady,
    danno~

    — answered May 11th 2010 by danno watts
    permalink
    0 Comments
  • Looks like events from tables are coming soon in 1.3

    http://github.com/appcelerator/titanium_mobile/commits/master

    — answered May 11th 2010 by George Bray
    permalink
    0 Comments
  • I have a feeling they're working on this at the moment. (having seen a recent commit to the source code)

    I need something like this too - but not with a yt embed. ;)

    — answered May 11th 2010 by Kosso
    permalink
    0 Comments
  • hey kosso & george,
    thanks for taking the time to answer, i really appreciate it.

    until 1.3 comes out, any suggestions on how to go about loading a youtube video on tap/click of a specific row?

    my next though/ option is to get rid of the row's altogether and just create a scrollView with the same layout i have already, but not in a tableView.
    thoughts?

    rocksteady,
    danno~

    — answered May 11th 2010 by danno watts
    permalink
    0 Comments
  • Hi,
    It all depends on your needs. (and/or patience ;) )

    If you really don't need a tableView, then I would suggest using a scrollView anyway. (That's what i use for YouTube videos and a host of other media types and sources)

    In fact that window with my scrollView is opened 'from' a tableView list of 'stuff' ;)

    — answered May 11th 2010 by Kosso
    permalink
    0 Comments
  • I would recommend against using webviews inside table view rows. Web views are the most expensive component we have in terms of system resources, and placing many of them in a table view might not be the best idea. Maybe it would be worth backing up a bit and trying to achieve your desired layout using native components.

    — answered May 11th 2010 by Kevin Whinnery
    permalink
    0 Comments
  • thanks for the tip about webviews kevin, didn't know they were that taxing.

    any suggestions for integrating youtube video playback using native components while keeping the user inside my app?

    — answered May 11th 2010 by danno watts
    permalink
    0 Comments
  • i guess a solution would be to have a thumbnail image loaded and then when clicked it would play the youtube video… how would i go about adding that action on a 'clicked' event?

    thanks!

    — answered May 11th 2010 by danno watts
    permalink
    0 Comments
  • But is there a way to make it clickable? I want to insert a ad-banner (Javascript in a WebView) into my table at some positions, and this one should expand after a click.

    — answered August 19th 2010 by Michael Gajda
    permalink
    0 Comments
  • Very late, but I figured out a way to get links inside a webView which is inside a tableView to work.

    First capture the click event on the webView and fire an event which includes the x/y position of where the user clicked.

    webview.addEventListener('click', function(e) {
        Ti.App.fireEvent('webViewClick', {
            x: e.x,
            y: e.y
        });
    }
    

    Then in your webview, listen for the event and use a little known (or at least to me) JS feature, elementFromPoint(x,y) to select the DOM element from an X/Y, and then synthesize the click event.

    Ti.App.addEventListener('webViewClick', function(e) {
        $(document.elementFromPoint(e.x, e.y)).click();
    }
    

    That uses jQuery, but could be done in pure JS if you are so inclined. Here's some more info about document.elementFromPoint(x,y).

    — answered July 19th 2011 by Phil Oye
    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.