Tip: Got source working for elements on table rows.
Not a question, but a tip, as this took me hours to figure out today:
I wanted to have a clickable image item on a tablerow (which itself is clickable).
As it's not possible to prevent the click on the tablerow from firing, I couldn't just add an image and have a clickhandler. (as it would fire on both the image and it's row).
In the end I did this: I added a custom param to the imageview, which I could check in the source param on the click.
var arrow = Ti.UI.createImageView({
url:'img/btn_more.png',
right:10,
top:28,
width:29,
height:29,
arrow: true
});
row.add(arrow);
//Later:
feedTableView.addEventListener('click', function(e){
if (e.source.arrow) {
opendetails(e.rowData);
}
Let's hope it helps someone.
Some complaints:
> - Most of the items mentioned with click aren't fired: I don't get coordinates.
> - Also details only fires if the row has a hasdetails.
> - And hasdetails doesn't work together with rightimage. All this is not documented at http://developer.appcelerator.com/apidoc/mobile/1.3/Titanium.UI.TableView-object
> - This is HARD to debug: JSON.stringify can't go into items that are more than just strings, which makes it hard to figure out what is actually sent. I should be able to do some sort of var_dump on the e in eventlistner.