Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28387] Android: index in TableView click event is no longer unique

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2021-05-18T18:11:13.000+0000
Affected Version/sRelease 9.3.2
Fix Version/sRelease 10.0.0, Release 9.3.3
ComponentsAndroid
LabelsTableView, android, regression
ReporterEwan Harris
AssigneeGary Mathews
Created2021-03-12T15:40:47.000+0000
Updated2021-05-18T18:11:16.000+0000

Description

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)

Comments

  1. Gary Mathews 2021-03-12

    master: https://github.com/appcelerator/titanium_mobile/pull/12558
  2. Lokesh Choudhary 2021-03-15

    FR Passed.
  3. Christopher Williams 2021-03-16

    merged to master; 10_0_X for 10.0.0 target; and 9_3_X branch.

JSON Source