Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15849] TableView event.index is wrong when TableView has sections (Mobile Web Only)

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2017-06-29T18:40:10.000+0000
Affected Version/sRelease 3.1.3, Release 3.2.0
Fix Version/sn/a
ComponentsMobileWeb
LabelsMobileWeb, TableView, TableViewRow, TableViewSection
ReporterJonah G
AssigneeChris Barber
Created2013-11-24T12:32:38.000+0000
Updated2018-04-04T23:20:21.000+0000

Description

Problem Description

This bug exists only on mobile web, not on Android on iOS. Screenshot of browser and description of bug !http://i.imgur.com/4O6TWd4.png! * If you click on "One", you'll see an alert for index 0, as expected. * If you click on "Three", you'll see an alert for index 1, as expected. * If you click on "Two", you'll see an alert for index 2, as expected. * If you click on "Four", you'll see an alert for index 2, **NOT AS EXPECTED** * And indeed, if you add more rows to the "Evens" section, they will all alert index 2. Also, the same problem occurs if I create the rows and sections using XML only.

Test case

 win = Titanium.UI.createWindow({
	backgroundColor : '#fff',
	exitOnClose : true
});

var aTableView = Ti.UI.createTableView();

var sections = [];
sections.push(Ti.UI.createTableViewSection({
	headerTitle : "Odds"
}));
sections[0].add(makeTableViewRow("One"));
sections[0].add(makeTableViewRow("Three"));
sections.push(Ti.UI.createTableViewSection({
	headerTitle : "Evens"
}));
sections[1].add(makeTableViewRow("Two"));
sections[1].add(makeTableViewRow("Four"));
aTableView.setData(sections);

function makeTableViewRow(rowText) {
	return Ti.UI.createTableViewRow({
		title : rowText,
		className : "row"
	});
}

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

win.add(aTableView);

win.open();

Steps to reproduce

1. Create a new project 2. Paste test code in app.js 3. Run on Mobile Web 4. Click on 4th Row its alert 2 but actual result 3

Comments

  1. Malcolm Hollingsworth 2013-11-24

    I have personally been involved in confirming the findings by Jonah in the Q&A, read the full interaction here; http://developer.appcelerator.com/question/159780/possible-bug-tableview-eventindex-is-wrong-when-tableview-has-sections I have confirmed the error does occur and that it only occurs in Mobile Web as other platforms report the correct response for the test case above.
  2. Malcolm Hollingsworth 2013-11-24

    Most recent builds tested with; Ti SDK 3.2.0.v20131117001643 Ti Studio 3.2.1.201311211948
  3. Mauro Parra-Miranda 2013-11-26

    Hello Jonah, Can you please post a test case that reproduces the issue in the form of a single app.js file? TIA! Best, Mauro
  4. Jonah G 2013-11-26

    Mauro, Sorry, I'm in like my first week of learning appcelerator and only know how to make things with the Alloy style. However, it literally takes under 60 seconds to create a new Alloy project, paste in my 3 code snippets into .js, .tss, and .xml files, and see the error in action. HTH, Jonah
  5. Lee Morris 2017-06-29

    Resolving ticket as "Won't fix" as MobileWeb has been deprecated.
  6. Eric Merriman 2018-04-04

    Closing as will not fix.

JSON Source