Titanium Community Questions & Answer Archive

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

Event handling: delegating TableViewRow events to underlying elements

I'm using a TableView to display a set of buttons and input fields - basically a form.

I've been using an event listener on each table row to cause interaction with the input element in that row. For example:

var view = Titanium.UI.createView({ height:'auto' }),
    row = Titanium.UI.createTableViewRow({height:ROW_HEIGHT});

var notes_input = Titanium.UI.createTextField();

row.addEventListener('click',function(e) { notes_input.focus(); } );

This works fine if there's only one input element in the row, but what do I do if there are multiple input elements? Eg. one row contains a button and a TextField, and I'd like to respond to which was pressed.

How can I use the click event to figure out whether the Button or the TextField was pressed?

I've tried setting events on the Button and TextField directly instead of setting it on the TableViewRow, but it seems the TableViewRow gets the click event first, eating it before it registers with the Button or TextField.

— asked August 31st 2010 by Parand Darugar
  • events
  • iphone

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.