[TIMOB-4206] Android: Image on table view cannot be dynamically changed
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-11-05T13:50:09.000+0000 |
Affected Version/s | Release 1.7.0 |
Fix Version/s | Sprint 2011-24, Release 1.7.2, Release 1.8.0 |
Components | Android |
Labels | n/a |
Reporter | Pedro Enrique |
Assignee | Bill Dawson |
Created | 2011-05-24T15:36:03.000+0000 |
Updated | 2011-11-05T13:50:09.000+0000 |
Description
Tried with two different codes:
var win = Ti.UI.createWindow();
var table = Ti.UI.createTableView();
var data = [];
for(var i = 0; i<30; i++){
var row = Ti.UI.createTableViewRow();
row.img = Ti.UI.createImageView({
image:'KS_nav_ui.png'
});
row.add(row.img);
data[i] = row;
}
table.data = data;
table.addEventListener('click', function(e){
e.row.img.image = 'KS_nav_views.png';
});
win.add(table);
win.open();
And this one:
var win = Ti.UI.createWindow();
var table = Ti.UI.createTableView();
var data = [];
var clicker = function(a, b){
a.addEventListener('click', function(e){
b.image = 'KS_nav_views.png';
});
}
for(var i = 0; i<30; i++){
var row = Ti.UI.createTableViewRow();
var img = Ti.UI.createImageView({
image:'KS_nav_ui.png'
});
row.add(img);
clicker(row, img);
data[i] = row;
}
table.data = data;
win.add(table);
win.open();
This creates a simple table view with an image view on each row. The goal is to change the image inside the rows when a row is clicked.
There is another helpdesk ticket also waiting for this to be fixed. http://support.appcelerator.com/tickets/APP-954973/homepage
Tested both cases.
Tested with Nexus S 2.3.4 and Nexus One 2.2.2 with 1.7.2.v20110630161836
Standardizing summary and labels.