{ "id": "93145", "key": "TIMOB-9702", "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": "13573", "description": "Sprint 2012-15 API", "name": "Sprint 2012-15 API", "archived": true, "released": true, "releaseDate": "2012-07-30" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" }, { "id": "14098", "description": "Sprint 2012-18 API", "name": "Sprint 2012-18 API", "archived": true, "released": true, "releaseDate": "2012-09-10" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-09-10T10:13:48.000+0000", "created": "2012-06-13T06:11:46.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "community", "module_tableview", "qe-review", "qe-testadded" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [], "assignee": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-09-11T01:58:39.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": "h2. The problem\r\n\r\n\"TableView\" component does not calculate number of rows well. It seems it counts rows from last section only. That cause issues when row is being updated or deleted by row index.\r\n\r\nh2. Test case\r\n\r\n\r\nTo see this issue, run this example:\r\n\r\n{code}\r\n(function() {\r\n \r\n var win = Ti.UI.createWindow({\r\n\t backgroundColor: '#000',\r\n\t navBarHidden: true\r\n\t});\r\n\t\r\n\t\r\n\tvar tableView = Ti.UI.createTableView();\r\n\t\r\n\tvar tableViewSection1 = Ti.UI.createTableViewSection({\r\n\t\theaderTitle: 'Section 1'\r\n\t});\r\n\t\r\n\tvar rows = [];\r\n\t\r\n\tfor (var i = 0; i < 10; ++i) {\r\n\t\trows[i] = Ti.UI.createTableViewRow({ title: 'Row ' + i });\r\n\t\ttableViewSection1.add(rows[i]);\r\n\t}\r\n\t\r\n\tvar tableViewSection2 = Ti.UI.createTableViewSection({\r\n\t\theaderTitle: 'Section 2'\r\n\t});\r\n\t\r\n\trows = [];\r\n\t\r\n\tfor (i = 0; i < 20; ++i) {\r\n\t\trows[i] = Ti.UI.createTableViewRow({ title: 'Row ' + (i + 10) });\r\n\t\ttableViewSection2.add(rows[i]);\r\n\t}\r\n\t\r\n\ttableView.setData([ tableViewSection1, tableViewSection2 ]);\r\n\t\r\n\ttableView.addEventListener('click', function(e) {\r\n\t\ttableView.updateRow(e.index, Ti.UI.createTableViewRow({ title: 'NEW Row' }));\r\n\t});\r\n\t\r\n\twin.add(tableView);\r\n\t \r\n\twin.open();\r\n \r\n})();\r\n{code}\r\n\r\n\r\nClick on \"Row 11\" in second section. You'll see that \"Row 21\" is updated.\r\n\r\nNow click on \"Row 23\" and you should get exception that says that index is invalid.\r\n\r\n\r\nh2. Expected behavior\r\n\r\n\r\nRow that is clicked should also be updated.\r\n\r\n\r\nThis works fine on iOS, and does not work on Android even prior to 2.1 (I tested with 1.8.3).", "attachment": [], "flagged": false, "summary": "Android: \"TableView\" doesn't counts rows well when there are table view sections present", "creator": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "* Titanium SDK version: 2.1.0 (06/12/12 17:02 40ba370)\r\n* v8\r\n* Android 3.1\r\n* Thinkpad tablet\r\n* OSX Lion", "comment": { "comments": [ { "id": "200514", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "IMHO, this issue should have bigger priority because there is no workaround and updating/deleting wrong row or crushing the app (if index is out of range) as the result of this issue is a big thing from usability point of view.\r\n\r\n\r\nDon't know how many developers use update/delete functionality, but it seems pretty basic thing to me.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-06-27T03:23:22.000+0000", "updated": "2012-06-27T03:23:22.000+0000" }, { "id": "200704", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Thanks. :)", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-06-28T00:07:57.000+0000", "updated": "2012-06-28T00:07:57.000+0000" }, { "id": "203094", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-07-13T01:31:28.000+0000", "updated": "2012-07-13T01:31:28.000+0000" }, { "id": "208774", "author": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pull request is https://github.com/appcelerator/titanium_mobile/pull/2623", "updateAuthor": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-20T16:33:23.000+0000", "updated": "2012-07-20T16:33:23.000+0000" }, { "id": "213826", "author": { "name": "rumbrasas", "key": "rumbrasas", "displayName": "Rima Umbrasas", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed with \r\nmobile sdk-2.2.0.v20120810080115\r\nTitanium Studio, build: 2.1.1.201207271312\r\nDevice:\r\nGalaxy S III Android version 4.0.4\r\n", "updateAuthor": { "name": "rumbrasas", "key": "rumbrasas", "displayName": "Rima Umbrasas", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-10T12:38:05.000+0000", "updated": "2012-08-10T12:38:05.000+0000" }, { "id": "217376", "author": { "name": "nchhabra", "key": "nchhabra", "displayName": "Neha Chhabra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Row 0 of Section 1 does not change,instead the first row of section 2 i.e. row 10 changes on click of row 0.\r\n\r\nVerified on:\r\nTested with Titanium Studio:2.1.2.201208301612\r\nTested with Titanium SDK: 2.2.0.v20120831200114", "updateAuthor": { "name": "nchhabra", "key": "nchhabra", "displayName": "Neha Chhabra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-09-04T04:25:24.000+0000", "updated": "2012-09-04T04:25:24.000+0000" }, { "id": "217892", "author": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It appears that a recent change here re-introduced a bug.\r\n\r\nPull Request https://github.com/appcelerator/titanium_mobile/pull/2880", "updateAuthor": { "name": "krowley", "key": "krowley", "displayName": "Karl Rowley", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-06T15:41:41.000+0000", "updated": "2012-09-06T15:41:41.000+0000" }, { "id": "218335", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified with:\r\n\r\nSDK: 3.0.0.v20120910184912\r\nSTUDIO: 2.1.3.201209071738\r\nDevice: Samsung galaxy tab(v 3.2)", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-11T01:58:39.000+0000", "updated": "2012-09-11T01:58:39.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }