I have the following thing to do:
I put an eventListener on the TableView which works fine. Unfortunately I have no idea how to separate the 1st column event from the 2nd column event. Any ideas?
Here is the source code:
var viewResults = Titanium.UI.createView({
...
});
...
for (rowId in rows) {
var tableRow = Titanium.UI.createTableViewRow();
var rowDelete = Titanium.UI.createView({
...
});
tableRow.add(rowDelete);
var rowProduct = Titanium.UI.createView({
...
});
tableRow.add(rowProduct);
tblData.push(tableRow);
}
tblResults.setData(tblData);
...
tblResults.addEventListener('click', function(e){
if (firstColumn) {
...
}else{
...
}
});
You can add custom property to views which you are creating:
var rowDelete = Titanium.UI.createView({
action: 'delete',
...
});
var rowProduct = Titanium.UI.createView({
action: 'product',
...
});
and then in eventListener check event.source property:
tblResults.addEventListener('click', function(e){
if (e.source.action === 'product') {
...
} else if (e.source.action === 'delete') {
...
}
});