Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13320] Android: Image in table row doesn't change or changes on a wrong row

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-04-04T18:01:35.000+0000
Affected Version/sRelease 3.0.2
Fix Version/sRelease 3.1.0, 2013 Sprint 07 Core, 2013 Sprint 07
ComponentsAndroid
Labelsmodule_tableviewrow, parity, qe-testadded, triage
ReporterJackieTai
AssigneeMax Stepanov
Created2012-09-18T20:10:24.000+0000
Updated2014-06-19T12:43:44.000+0000

Description

*Problem description* A table with 2 table view sections, each section contains some rows, in each row there's a label and image view. When the user clicks on the image, the image should change to another one, and when the user clicks on the row it should change back. This causes 2 problems on Android only: 1. If user keep click on selection 1 row image and then click on selection 2 same row image, the table will start to to act incorrectly (click on selection1 image row will change selection2 same row image). 2. Sometimes when user click on the row, the image doesn't change back. *Steps to reproduce* Just keep tapping on these two section rows or images, you will see the problem. *Test case*
var win1 = Titanium.UI.createWindow({
	title : 'Tab 1',
	backgroundColor : '#fff'
});

var tableView = Titanium.UI.createTableView();

tableView.addEventListener("click", function(e) {
	if (e.source.sw) {
		e.row.children[1].image = '/KS_nav_views.png'
	} else {
		e.row.children[1].image = '/KS_nav_ui.png'
	}
	tableView.setData(tableView.getData());
	//why I have to do this, in order to show the change
});

if (Ti.Platform.osname === 'iphone')
	tableView.style = Ti.UI.iPhone.TableViewStyle.GROUPED;

var tvs = [];
//------------------------------- tvs1
tvs[0] = Ti.UI.createTableViewSection({
	headerTitle : 'Selection 1'
});
//------------------------------- tvs2
tvs[1] = Ti.UI.createTableViewSection({
	headerTitle : 'Selection 2'
});

for ( i = 0; i < 2; i++) {
	for ( j = 0; j < 3; j++) {
		var label = Ti.UI.createLabel({
			left : 8,
			text : "Label " + j
		});

		var imgSw = Ti.UI.createImageView({
			right : 2,
			height : 48,
			width : 48,
			image : '/KS_nav_ui.png',
			sw : true
		});

		var row = Ti.UI.createTableViewRow({
			height : 48,
			className : 'row'
		});

		row.add(label);
		row.add(imgSw);
		tvs[i].add(row);
	}
}

tableView.setData(tvs);
win1.add(tableView);
win1.open(); 

Comments

  1. Anirudh Nagesh 2012-09-19

  2. JackieTai 2012-09-19

    yes they're, but mine is more serious, because not only the image doesn't change, they'll change on a wrong row (click on one row image will change on other row image, usually on other table selection), I guess this is because I'm using more than on table selection. please fix it.
  3. Daniel Sefton 2013-04-02

    Tested and confirmed with 3.0.2 GA on Samsung Galaxy S2 Android 2.3.6. Also confirmed that it works fine on iOS 6 simulator.
  4. Max Stepanov 2013-04-03

    Reproduced with 3.0.2.GA on 2.2 Emulator. Cannot reproduce with 3.1.0 on Emulator or device. Removing className on TableViewRow fixes the issue on 3.0.2.GA
  5. Anshu Mittal 2013-04-08

    Tested with: SDK: 3.1.0.v20130405170202 Studio:3.1.0.201304011603 Device: Samsung galaxy note(2.3.6) OS: OSX 10.7.5 Works as expected

JSON Source