Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25275] Windows: index property of TableView click event should be index of whole TableView and not section

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-11-13T18:40:01.000+0000
Affected Version/sRelease 6.0.4, Release 6.1.2, Release 7.0.0, Release 6.2.0
Fix Version/sRelease 7.0.0
ComponentsWindows
Labelsn/a
ReporterEwan Harris
AssigneeKota Iguchi
Created2017-09-13T14:52:35.000+0000
Updated2017-11-16T02:42:55.000+0000

Description

Description

The index property of a tableview click event is in relation to the tableviewsection, it should be in relation to the entirety of the tableview
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]
});

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

win.add(table);
win.open();

Steps to reproduce

Add the above to an existing app.js and build for Windows

Click Row 10 in section 2

Actual

Row 0 in Section 1 gets updated

Expected

Row 10 in section 2 should be updated

Comments

  1. Kota Iguchi 2017-10-12

    https://github.com/appcelerator/titanium_mobile_windows/pull/1144
  2. Abir Mukherjee 2017-11-16

    Changes are seen in 7.0.0.v20171115153702.

JSON Source