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.