Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2120] Android: TableView click on subview

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-02-05T00:08:15.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsparity
ReporterMartin Guillon
AssigneeMauro Parra-Miranda
Created2012-10-14T17:19:26.000+0000
Updated2016-03-08T07:41:05.000+0000

Description

*Problem description* Running the code below on iOS, you get TableView click when pressing on rows subviews. The event source is the subview but you still get the row property and the index. That's practical as you dont have to use "touchEnabled". On Android you get the click event but not the row property. We should get that property too on android. *Test case*
var win = Titanium.UI.createWindow();
win.backgroundColor = '#ccc';

var tableview = Ti.UI.createTableView();
win.add(tableview);

var rowData = [];
for (var i = 0; i < 10; i++) {
	var row = Ti.UI.createTableViewRow({
		title : 'row ' + i,
		name : 'row ' + i
	});
	var view = Ti.UI.createView({
		width : 100,
		height : 30,
		backgroundColor : 'blue'
	})
	row.add(view);

	var view2 = Ti.UI.createLabel({
		width : 50,
		height : 30,
		backgroundColor : 'red'
	})
	view.add(view2);
	rowData.push(row);
};
tableview.data = rowData;

tableview.addEventListener('click', function(e) {
	if (e.row)
		alert('we got a row! ');
	else
		alert('we got a click but no row! ');
})

win.open();

Attachments

FileDateSize
Screenshot_2_4_13_4_04_PM.png2013-02-05T00:07:56.000+000077321

Comments

  1. Jamie Buckley 2013-02-05

    Hi Martin, I tested this on the 4.0.3 android simulator and received a row on the click event, screenshot attached.
  2. Martin Guillon 2013-02-05

    Did you click on a subview? Cause it s normal to see the dialog if you click on the row itself
  3. Daniel Sefton 2013-02-05

    Hi Martin, I tested this myself on an Android 2.3.3 device with 3.0 GA and 3.1 master, I also always get the row even when tapping on either subview... Edit: I guess I should test on a 4.0.3 device, but if it doesn't happen in the 4.0.3 emulator then... Edit2: Tested on a 4.2.1 device, still can't reproduce. I know it's not 4.0.3, but I'm not able to get my hands on that specific version right now. I'm going to conclude that it's very unlikely it will not work on 4.0.3. Maybe you have some custom code in your 3.1 build like you've realised in the past?
  4. Martin Guillon 2013-02-14

    @Daniel: sorry it took me so long to respond. I you cant reproduce just close it :s I am really sorry it must have been fixed somewhere. I also remember fixing it myself, but it s too far down the road :s Sorry again

JSON Source