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 Event in a createTableViewRow

I want to have a clickable list that contain buttons/images.

My problem

  1. If i added Buttons in the list, it will remove the onclick event of the row.
  2. If i used Images as buttons, it will trigger both, the row onclick and the Image onclick.

So how can i create buttons in a list, without removing the onclick of the row. OR using images as buttons, without triggering duplicate onclick event.

— asked May 25th 2010 by Seif Sallam
  • android
  • mobile

2 Answers

  • when you create your row, make sure you add the selectionStyle property

    var row = Ti.UI.createTableViewRow({height:60,selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE});

    Also, what I do is add a rowData property to the rows I don't want clicks on using eg: row.noClicks = true;

    Then I can check for this on the tableView click event:

            } else {
        // do something based on the click on row number: e.index

    you might also be able to set touchEnabled:false in the row creation itself - but don't quote me on that ;)

    — answered May 26th 2010 by Kosso
  • Thanks for the reply, here is what happened.

    This didn't work because i'm on Android, and this was Titanium iPhone. there was an error because of using NONE

    var row = Ti.UI.createTableViewRow({height:60,selectionStyle:Ti.UI.iPhone.TableViewCellSelectionStyle.NONE});

    When i tried the rest of the code, the problem still exist, i can click on buttons, but i can't click on the row.

    — answered May 26th 2010 by Seif Sallam
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.