Titanium Community Questions & Answer Archive

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

Table row with both HasDetails and RightImage?

I'm trying to change the blue image that's added to a tablerow when I set HasDetails to true from blue to red.
If I set the image with rightimage, it does apear. However, a click on the tablerow now longer fires the details flag, so I can't detect a click on the rightimage versus a click on the row itself.
Any way to have these working together?
The click event also doesn't seem to fire it's coordinates, which would provide a workaround.
Currently I can choose between having it working, with the default image, or have a changed image and not working functionality. Any idea's?

The code:

    var row =  Ti.UI.createTableViewRow({
                height:90,
                hasDetail:true,
                rightImage: 'img/btn_more.png'
            }); 


TableView.addEventListener('click', function(e){
    if (e.detail) {
    //Details clicked, open that. Only works with no rightimage?!
    } else {
//Row clicked
}
});
— asked August 26th 2010 by Martijn Pannevis
  • click
  • hasdetails
  • iphone
  • rightimage
  • tablerow
0 Comments

2 Answers

  • Had the same situation and what I discovered was that when you have a rightImage in place, the 'click' event will return x and y values of 0. Thus:

    tableview.addEventListener('click', function(e) {
        if (e.x == 0 && e.y == 0) {
            //*** Do the detail action
        } else {
            //*** Do the normal click action
        }
    });
    
    — answered June 6th 2011 by Mark Pemburn
    permalink
    0 Comments
  • I think you will have to build a custom row for this, and detect the click on the image.

    — answered August 26th 2010 by Dan Tamas
    permalink
    1 Comment
    • I can detect the click of the image, but it also triggers a click on the row. How do I make the click not trigger the layers below?

      — commented August 27th 2010 by Martijn Pannevis
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.