Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10238] Android: Wrong row index when using TableView with Ti.UI.SIZE and specifying row className

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-19T14:46:41.000+0000
Affected Version/sRelease 2.1.1
Fix Version/sRelease 3.0.0, Sprint 2012-19 Core, 2012 Sprint 19
ComponentsAndroid
LabelsSupportTeam, core, module_tableview, qe-testadded
ReporterIvan Skugor
AssigneeKarl Rowley
Created2012-07-25T02:35:41.000+0000
Updated2013-07-12T07:13:54.000+0000

Description

Problem description

row "index" value it's wrong when using tableViews, with Ti.UI.SIZE height property set, containing complex rows (rows that contain other components) with "className" property set.

Steps to reproduce

Run the sample code:
var win = Ti.UI.createWindow({ backgroundColor: "#000", navBarHidden: true, layout: 'vertical', fullscreen: true });

var table = Ti.UI.createTableView({
	height: Ti.UI.SIZE
});

var data = [], row;

for (var i = 0; i < 10; ++i) {
	
	row = Ti.UI.createTableViewRow({ height: 75, className: 'RowClass' });
	row.add(Ti.UI.createLabel({ text: 'Row ' + i, left: 10, height: Ti.UI.FILL, width: Ti.UI.FILL }));
	
	data[i] = row;
}

table.setData(data);

table.addEventListener('click', function(e) {
	alert('Index: ' + e.index);
});


win.add(table);

win.open();
Click on any row except the last one. You should get alert dialog saying that index is 9. After first click example usually works fine (only first click generates wrong index), but sometimes it does not work (it seems that issue is random and sometimes index is 9 and sometimes index is the index of the row that was clicked). The only reliable information is that first click never generates right index. Not specifying 'height' value, setting it to 'auto' or if "className" property is commented out, everything works fine.

Comments

  1. Carter Lathrop 2012-07-30

    Have tested this bug and is valid
  2. Brian Knorr 2012-09-06

    Please ensure that when this is considered fixed, that it actually does fix the duplicate issue TIMOB-10712. Thanks, Brian
  3. Karl Rowley 2012-09-18

    Pull request https://github.com/krowley/titanium_mobile/commit/e0ae2925450452068fd5afca8b2e9f696290155b
  4. Brian Knorr 2012-09-19

    Can you please confirm that this fixes the duplicate issue TIMOB-10712? If it doesn't this is not a duplicate. Please advise.
  5. Thomas Huelbert 2012-09-24

    Brian, as this fix did not address the issue in 10712 that bug is still open and being addressed. Thanks!
  6. Tamila Smolich 2012-12-04

    Closing as fixed. Tested on: Titanium Studio, build: 3.0.0.201211301903 Titanium SDK, build: 3.0.0.v20121130200208 Devices: Samsung Galaxy S III (4.0.4)

JSON Source