[TIMOB-13055] Android: tableview events: missing "row" property
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-04-01T17:20:36.000+0000 |
Affected Version/s | Release 3.1.0, 2013 Sprint 07 Core, 2013 Sprint 07 |
Fix Version/s | Release 3.1.0, 2013 Sprint 07 Core, 2013 Sprint 07 |
Components | Android |
Labels | qe-testadded, triage |
Reporter | Martin Guillon |
Assignee | Allen Yeung |
Created | 2012-10-16T10:39:51.000+0000 |
Updated | 2013-04-19T11:09:20.000+0000 |
Description
On android, when firing an event on a tableview, not all events a correctly filled with "row" property.
Only click directly on the row (not subview) and longpress are.
Other events like should be filled to
var win = Ti.UI.createWindow();
win.backgroundColor = 'white';
var data = [];
for (var x=0;x<4;x++)
{
var label = Ti.UI.createLabel({
text:'Row Label ' + x,
height:'auto',
width:'auto',
color:'#336699',
left:10
});
var row = Ti.UI.createTableViewRow({height:50});
row.add(label);
data.push(row);
}
// create table view
var tableview = Titanium.UI.createTableView({
data:data
});
function log(e) {
if (e.row)
Ti.API.info('we got row property for event ' + e.type);
}
tableview.addEventListener('longpress', log);
tableview.addEventListener('swipe', log);
tableview.addEventListener('touchstart', log);
tableview.addEventListener('touchend', log);
tableview.addEventListener('touchcancel', log);
win.add(tableview);
win.open();
I can second this issue. The object passed to the click event is the actual clicked object, not the row. For me there is no way to identify which row was clicked, and right now I cannot access any extra parameters added to the row, without extra coding...
same problem here, no e.row.id in longpress click, so I can't identify it.
Actually i fixed this in my branch. Will have to point the commits and make a pull request out of it
Martin: Do you have a pull request ready for this yet? Thanks!
here you go https://github.com/appcelerator/titanium_mobile/pull/3872 But read the details, i also changed the method to get the current row
Fill row information for all events fired from TableViewRowProxy https://github.com/appcelerator/titanium_mobile/pull/3975
PR: https://github.com/appcelerator/titanium_mobile/pull/4039
Expanded test case that checks the source of the event as well.
https://github.com/appcelerator/titanium_mobile/pull/4039 merged
Additional null check https://github.com/appcelerator/titanium_mobile/pull/4078
backport: https://github.com/appcelerator/titanium_mobile/pull/4079
All events defined for row in app.js are being logged now. Environment used for verification - SDK: 3.1.0.v20130405170202 Studio:3.1.0.201304011603 Device: Samsung GALAXY tab (3.2) and Samsung Galaxy Nexus Android 4.0.2
Added the testcase in the testsuite under TableView.