Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3751] iOS: Dynamically change the backgroundImage of a TableViewRow

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-02-11T21:54:11.000+0000
Affected Version/sRelease 1.6.0 M10, Release 2.0.1, Release 3.1.0
Fix Version/sRelease 3.2.0
ComponentsiOS
Labelsmodule_tableviewrow, qe-closed-3.2.2, qe-testadded
ReporterPedro Enrique
AssigneeIngo Muschenetz
Created2011-04-27T09:02:46.000+0000
Updated2014-03-14T06:46:57.000+0000

Description

This code supposedly changes the background image of the clicked row:
var window = Ti.UI.createWindow({
  backgroundColor:'white'
});

var myTable = Titanium.UI.createTableView({});

for (var i = 0; i < 40; i++) {
	var row = Ti.UI.createTableViewRow({
		height:30,color:"white"
	});
	
	row.backgroundImage='KS_nav_views.png';
	
	myTable.appendRow(row);	
}

var sections = myTable.data;
var section = sections[0];

myTable.addEventListener('click', function(e){
        alert(e.row);
        e.row.backgroundImage='KS_nav_ui.png';
});


window.add(myTable);


window.open({modal:true});
But it does nothing. There is a Helpdesk ticket that encounter this: http://support.appcelerator.com/tickets/APP-126267/homepage What this ticket is asking, is not to change the bg image, but to remove it. That could be a feature request as well.

Comments

  1. Matthew Congrove 2011-05-03

    Another ticket with this problem: http://support-admin.appcelerator.com/display/APP-637384 Also, CDC is waiting on this functionality. The table needs to be triggered to redraw when the backgroundImage property is modified.
  2. Jacob Relkin 2011-05-05

    Fixed spelling error in title.
  3. Junaid Younus 2012-05-18

    Tested with 2.0.1GA2 on the iOS simulator, issue still reproducible. I have noticed that if you click on the same row twice, it will change the image, but it should work the first time.
  4. Shameer Jan 2013-05-09

    Issue exist with release 3.1.0.if you click on the same row twice, it will change the image, Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 iOS iPhone Simulator: iOS SDK version: 6.0
  5. Shak Hossain 2014-02-11

    This issue can't be reproduced with TISDK 3.2 or higher. Therefore, marking it as resolved.
  6. Paras Mishra 2014-03-10

    Verified the fix, hence closing the issue. Environment used: Device : iPhone 5s , iOS version : 7.1 SDK: 3.2.2.v20140221161255 CLI version : 3.2.1 OS : MAC OSX 10.9 Alloy: 1.3.1 ACS: 1.0.14 npm:1.3.2 Appcelerator Studio, build: 3.2.2.201402280732 titanium-code-processor: 1.1.0 XCode : 5.1 Beta 5

JSON Source