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.
Have tested this bug and is valid
Please ensure that when this is considered fixed, that it actually does fix the duplicate issue TIMOB-10712. Thanks, Brian
Pull request https://github.com/krowley/titanium_mobile/commit/e0ae2925450452068fd5afca8b2e9f696290155b
Can you please confirm that this fixes the duplicate issue TIMOB-10712? If it doesn't this is not a duplicate. Please advise.
Brian, as this fix did not address the issue in 10712 that bug is still open and being addressed. Thanks!
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)