Description
The index property in a click event of a TableView is no longer unique within the tableview, it's not per TableViewSection
var win = Ti.UI.createWindow();
var sectionFruit = Ti.UI.createTableViewSection({ headerTitle: 'Fruit' });
sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Apples' }));
sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Bananas' }));
var sectionVeg = Ti.UI.createTableViewSection({ headerTitle: 'Vegetables' });
sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Carrots' }));
sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Potatoes' }));
var table = Ti.UI.createTableView({
data: [sectionFruit, sectionVeg]
});
win.add(table);
win.open();
table.addEventListener('click', function(e){
Ti.API.info('click listener:::::::::::'+JSON.stringify(e.index));
});
var sectionFish = Ti.UI.createTableViewSection({ headerTitle: 'Fish' });
sectionFish.add(Ti.UI.createTableViewRow({ title: 'Cod' }));
sectionFish.add(Ti.UI.createTableViewRow({ title: 'Haddock' }));
table.insertSectionBefore(0, sectionFish);
Steps to reproduce
1. Add the code above to an existing app.js and build for Android
2. Click
Cod
and click
Apple
Actual
The index logged is the same (0)
Expected
The index logged should not be the same, (0 and 2 respectively)
master: https://github.com/appcelerator/titanium_mobile/pull/12558
FR Passed.
merged to master; 10_0_X for 10.0.0 target; and 9_3_X branch.