{ "id": "104942", "key": "TIMOB-11762", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "14164", "description": "Release 3.0.2", "name": "Release 3.0.2", "archived": true, "released": true, "releaseDate": "2013-02-19" }, { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "14811", "description": "2013 Sprint 01 API", "name": "2013 Sprint 01 API", "archived": true, "released": true, "releaseDate": "2013-01-14" }, { "id": "14804", "description": "2013 Sprint 01", "name": "2013 Sprint 01", "archived": true, "released": true, "releaseDate": "2013-01-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-01-28T10:30:24.000+0000", "created": "2012-11-14T11:16:12.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "SupportTeam", "module_tableviewrow", "qe-testadded", "triage" ], "versions": [], "issuelinks": [ { "id": "24640", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "98702", "key": "TIMOB-10342", "fields": { "summary": "Android: Image view in a table view row can not be dynamically changed more than once.", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "25009", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "outwardIssue": { "id": "108346", "key": "TIMOB-12362", "fields": { "summary": "Android: NPE in KS Remote Image test", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "24689", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "108103", "key": "TIMOB-12339", "fields": { "summary": "Backport TIMOB-11762 to 3.0.2", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "5", "description": "The sub-task of the issue", "name": "Sub-task", "subtask": true } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2015-06-12T16:42:36.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h1. Problem description\r\nTrying to update an image inside a TableViewRow works only a couple of time; after that, the image properties can be changed (e.g. right), but not the image itself.\r\n\r\nh1. Steps to reproduce\r\nUse the following code:\r\n\r\n{code}\r\nTi.UI.backgroundColor = '#e3e8ee';\r\n\r\nvar win = Ti.UI.createWindow();\r\nvar table = Ti.UI.createTableView();\r\nvar rows = [];\r\n\r\nfor (var i = 1; i <= 50; i++) {\r\n\tvar row = Ti.UI.createTableViewRow({\r\n\t\theight\t: '40dp'\r\n\t});\r\n\r\n\tvar label = Ti.UI.createLabel({\r\n\t\theight\t: Ti.UI.SIZE,\r\n\t\tleft\t: '5dp',\r\n\t\ttext\t: 'Row ' + i,\r\n\t\ttop\t\t: '5dp',\r\n\t\twidth\t: Ti.UI.SIZE\r\n\t});\r\n\trow.text = label;\r\n\trow.add(row.text);\r\n\r\n\tvar image = Ti.UI.createImageView({\r\n\t\theight\t: '28dp',\r\n\t\timage\t: '/images/radiobutton_off.png',\r\n\t\tright\t: '0dp',\r\n\t\ttop\t\t: '5dp',\r\n\t\twidth\t: '34dp'\r\n\t});\r\n\trow.image = image;\r\n\trow.add(row.image);\r\n\t\r\n\trows.push(row);\r\n}\r\n\r\ntable.setData(rows);\r\n\r\nwin.add(table);\r\nwin.open();\r\n\r\nsetActive(0);\r\n\r\n\r\nfunction setActive (_index) {\r\n\tfor (var i = 0; i < table.data[0].rows.length; i++) {\r\n\t\tif (i === _index) {\r\n\t\t table.data[0].rows[i].text.text = \"Row \" + i + \" ON\";\r\n\t\t\ttable.data[0].rows[i].image.image = '/images/radiobutton_on.png';\r\n\t\t\ttable.data[0].rows[i].image.right = '50dp';\r\n\t\t}\r\n\t\telse {\r\n\t\t table.data[0].rows[i].text.text = \"Row \" + i;\r\n\t\t\ttable.data[0].rows[i].image.image = '/images/radiobutton_off.png';\r\n\t\t\ttable.data[0].rows[i].image.right = '0dp';\r\n\t\t}\r\n\t}\r\n}\r\n\r\ntable.addEventListener('click', function (e) {\r\n\tsetActive(e.index);\r\n});\r\n{code}\r\n\r\nRunning the code on Android, you can notice how automatically the first row changes: the label text shows \"ON\", the image is moved 30dp from the right and the image itself changes to the active button.\r\n\r\nClicking a row, the process works again on that row.\r\n\r\nClick the second time and everything changes, but the image.\r\n\r\nh1. Note\r\nI tried SDK from 2.1.3 to 3.0.0, same behavior. I also tried adding a className to the rows (both same class for all the rows, or a different one per row), nothing changes.", "attachment": [], "flagged": false, "summary": "Android: can't update image inside a TableViewRow", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Android\r\nSDK 2.1.3\r\nSDK 2.1.4\r\nSDK 3.0.0\r\n", "comment": { "comments": [ { "id": "229613", "author": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "body": "The workaround involves using 2 images instead of one, and showing/hiding them.\n\n{code}\nTi.UI.backgroundColor = '#e3e8ee';\n \nvar win = Ti.UI.createWindow();\nvar table = Ti.UI.createTableView();\nvar rows = [];\n \nfor (var i = 1; i <= 50; i++) {\n var row = Ti.UI.createTableViewRow({\n height : '40dp'\n });\n \n var label = Ti.UI.createLabel({\n height : Ti.UI.SIZE,\n left : '5dp',\n text : 'Row ' + i,\n top : '5dp',\n width : Ti.UI.SIZE\n });\n row.text = label;\n row.add(row.text);\n \n var imageOn = Ti.UI.createImageView({\n height : '28dp',\n image : '/images/radiobutton_on.png',\n right : '0dp',\n top : '5dp',\n width : '34dp',\n visibile: false\n });\n row.imageOn = imageOn;\n row.add(row.imageOn);\n\n var imageOff = Ti.UI.createImageView({\n height : '28dp',\n image : '/images/radiobutton_off.png',\n right : '0dp',\n top : '5dp',\n width : '34dp'\n });\n row.imageOff = imageOff;\n row.add(row.imageOff);\n \n rows.push(row);\n}\n \ntable.setData(rows);\n \nwin.add(table);\nwin.open();\n \nsetActive(0);\n \n \nfunction setActive (_index) {\n for (var i = 0; i < table.data[0].rows.length; i++) {\n if (i === _index) {\n table.data[0].rows[i].text.text = \"Row \" + i + \" ON\";\n table.data[0].rows[i].imageOff.visible = false;\n table.data[0].rows[i].imageOn.visible = true;\n }\n else {\n table.data[0].rows[i].text.text = \"Row \" + i;\n table.data[0].rows[i].imageOn.visible = false;\n table.data[0].rows[i].imageOff.visible = true;\n }\n }\n}\n \ntable.addEventListener('click', function (e) {\n setActive(e.index);\n});\n{code}", "updateAuthor": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-12-03T18:27:55.000+0000", "updated": "2012-12-03T18:27:55.000+0000" }, { "id": "233967", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/3689", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-11T10:53:30.000+0000", "updated": "2013-01-11T10:53:30.000+0000" }, { "id": "235030", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Image is getting updated for every click.\r\nEnvironment used for verification -\r\nTitanium SDK: 3.1.0.v20130114171802\r\nTitanium  Studio:3.0.1.201212181159\r\nDevice: Samsung GALAXY Note (2.3.6)", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-20T22:50:16.000+0000", "updated": "2013-01-20T22:50:16.000+0000" }, { "id": "235267", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Reopening to edit fixVersion", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-01-21T22:15:09.000+0000", "updated": "2013-01-21T22:15:09.000+0000" }, { "id": "236160", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening to update labels", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-28T10:29:53.000+0000", "updated": "2013-01-28T10:29:53.000+0000" }, { "id": "350984", "author": { "name": "geervani", "key": "geervani", "displayName": "Geervani", "active": true, "timeZone": "America/Los_Angeles" }, "body": "the issue still exists in 3.5.0", "updateAuthor": { "name": "geervani", "key": "geervani", "displayName": "Geervani", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-28T10:11:12.000+0000", "updated": "2015-04-28T10:11:12.000+0000" }, { "id": "355019", "author": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "body": "I'm still having this issue in 4.0.0.GA", "updateAuthor": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "created": "2015-06-12T16:42:36.000+0000", "updated": "2015-06-12T16:42:36.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }