Titanium Community Questions & Answer Archive

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

Tip: Got source working for elements on table rows.

Not a question, but a tip, as this took me hours to figure out today:
I wanted to have a clickable image item on a tablerow (which itself is clickable).
As it's not possible to prevent the click on the tablerow from firing, I couldn't just add an image and have a clickhandler. (as it would fire on both the image and it's row).

In the end I did this: I added a custom param to the imageview, which I could check in the source param on the click.

            var arrow = Ti.UI.createImageView({
                arrow: true

feedTableView.addEventListener('click', function(e){

if (e.source.arrow) {

Let's hope it helps someone.

Some complaints:
> - Most of the items mentioned with click aren't fired: I don't get coordinates.
> - Also details only fires if the row has a hasdetails.
> - And hasdetails doesn't work together with rightimage. All this is not documented at http://developer.appcelerator.com/apidoc/mobile/1.3/Titanium.UI.TableView-object
> - This is HARD to debug: JSON.stringify can't go into items that are more than just strings, which makes it hard to figure out what is actually sent. I should be able to do some sort of var_dump on the e in eventlistner.

— asked August 31st 2010 by Martijn Pannevis
  • click
  • iphone
  • source
  • tablerow
1 Comment
  • THANK YOU! the portion about "e.source" helped me get a parameter through from a label in a row.

    — commented August 16th 2012 by Jonathan Wheat

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.