{ "id": "111159", "key": "TIMOB-13052", "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": "15397", "description": "2013 Soprint 07 API", "name": "2013 Sprint 07 API", "archived": true, "released": true, "releaseDate": "2013-04-08" }, { "id": "15105", "description": "2013 Sprint 07", "name": "2013 Sprint 07", "archived": true, "released": true, "releaseDate": "2013-04-08" }, { "id": "15384", "description": "Release 2.1.5", "name": "Release 2.1.5", "archived": true, "released": false } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-04-01T17:16:51.000+0000", "created": "2013-03-13T19:07:38.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "qe-closed-3.3.0", "qe-testadded", "tableview", "tableviewrow" ], "versions": [], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-07-01T10:52:48.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": "h3. The Problem\r\nUsing Ti SDK 2.1.x... When clicking on a row, the event fires on a different one. This works fine in 3.0.x \r\nh3. The code\r\nUse this code in app.js\r\n{code}\r\n\r\nfunction CheckBox() {\r\n var btn = Ti.UI.createButton({\r\n width : 28,\r\n height : 28,\r\n backgroundImage: 'check_grey.png',\r\n right: 10\r\n });\r\n\r\n var checked = false;\r\n \r\n btn.addEventListener('btn_click', function(){\r\n if(checked) {\r\n btn.backgroundImage = 'check_grey.png';\r\n } else {\r\n btn.backgroundImage = 'check_blue.png';\r\n }\r\n checked = !checked;\r\n });\r\n\r\n return btn;\r\n}\r\n\r\nfunction TableViewRow(n) {\r\n var row = Ti.UI.createTableViewRow({\r\n backgroundColor: '#ccc',\r\n className: 'my_row',\r\n height: 35\r\n });\r\n \r\n var checkBox = CheckBox();\r\n row.addEventListener('click', function(){\r\n checkBox.fireEvent('btn_click');\r\n });\r\n row.add(checkBox);\r\n \r\n var label = Ti.UI.createLabel({\r\n left: 10,\r\n width: 100,\r\n height: 30,\r\n text: 'Row #' + (n+1),\r\n color: 'black'\r\n });\r\n row.add(label);\r\n return row;\r\n}\r\n\r\nvar win = Ti.UI.createWindow();\r\nvar tableData = [];\r\nfor(var i = 0; i < 100; i++) {\r\n tableData.push(TableViewRow(i));\r\n}\r\n\r\nvar table = Ti.UI.createTableView({\r\n data: tableData\r\n});\r\nwin.add(table);\r\n\r\nwin.open();\r\n{code}\r\nh3. To Reproduce\r\n1. Copy that code into app.js\r\n2. Run on device (Galaxy S3 in my case)\r\n3. Click on a row and you'll see the image on the button being changed\r\n4. Scroll down and up\r\n5. Click again and different row from the one clicked will fire the event.", "attachment": [], "flagged": false, "summary": "Android: TableViewRow index confused in row click", "creator": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Android \r\nTi SDK 2.1.4\r\nGalaxy S3", "comment": { "comments": [ { "id": "244633", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending against 2_1_X branch\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/4055", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-03-29T04:54:42.000+0000", "updated": "2013-03-29T04:54:42.000+0000" }, { "id": "311785", "author": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified with:\r\n\r\nAppcelerator-Studio:3.3.0.201406271159\r\nSdk:3.3.0.v20140627202512\r\nacs:1.0.14\r\nalloy:1.4.0-rc3\r\nnpm:1.3.2\r\ntitanium:3.3.0-rc4\r\ntitanium-code-processor:1.1.1\r\nxcode:5.1.1\r\nOS:Maverick(10.9.3)\r\nDevice:iPhone5c(v7.1.1),LG-P970(v4.0.4)\r\n\r\n", "updateAuthor": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-07-01T10:52:07.000+0000", "updated": "2014-07-01T10:52:07.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }