{ "id": "61172", "key": "TIMOB-540", "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": "11363", "description": "Mobile 1.8.0 M10", "name": "Sprint 2011-31", "archived": true, "released": true, "releaseDate": "2011-08-08" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-10-27T15:52:02.000+0000", "created": "2011-04-15T02:31:27.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "tableview", "tableviewrow" ], "versions": [ { "id": "11260", "description": "", "name": "Release 1.6.2", "archived": true, "released": true, "releaseDate": "2011-04-20" }, { "id": "11367", "description": "", "name": "Release 1.7.1", "archived": true, "released": true, "releaseDate": "2011-06-21" } ], "issuelinks": [], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-10-27T15:52:02.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h1. Problem\r\ninsertRowBefore adds rows at the incorrect spot.\r\n\r\nh2. Reproduction\r\nDrop the following in an app.js.\r\n1. It has a table with two rows: A and C.\r\n2. It attempts to insert a row B before C.\r\n3. The rows end up being BAC, instead of the expected ABC.\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({ backgroundColor: '#fff' });\r\nwin.open();\r\n\r\nvar data = [\r\n { title: 'A', name: 'A' },\r\n { title: 'C', name: 'C' }\r\n];\r\n\r\nvar tableview = Ti.UI.createTableView({ data: data });\r\nwin.add(tableview);\r\n\r\nfunction checkIndex(name, expected) {\r\n var actual = tableview.getIndexByName(name);\r\n Ti.API.info(name + \"'s Index: \" + actual);\r\n if (actual != expected) {\r\n alert(name + ' has an inaccurate index! expected: ' + expected + ', actual: ' + actual);\r\n }\r\n}\r\n\r\nsetTimeout(function() {\r\n tableview.insertRowBefore(tableview.getIndexByName('C'), { title: 'B', name: 'B' });\r\n\r\n checkIndex('A', 0);\r\n checkIndex('B', 1);\r\n checkIndex('C', 2);\r\n}, 1000);\r\n{code}\r\n\r\nh2. Expected Behavior\r\nCalling \"insertRowBefore\" a row should insert the row before the specified row. It should _not_ insert the row two rows before the specified row.", "attachment": [], "flagged": false, "summary": "Tableview.insertRowBefore(index, row, options) Inserts in wrong Index", "creator": { "name": "dukz", "key": "dukz", "displayName": "dukz", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": null, "comment": { "comments": [ { "id": "123512", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This is expected behavior.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:28.000+0000", "updated": "2011-04-15T02:31:28.000+0000" }, { "id": "156564", "author": { "name": "akulinich", "key": "akulinich", "displayName": "Andrew Kulinich", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In this case following code behaves the same:\n{code}\ntableview.insertRowBefore(0, { title: '0' });\ntableview.insertRowBefore(1, { title: '1' });\n{code}\nIt insert both lines before the first record.\nWhat is worse - it is impossible to insert row before last row.\nSo as a developer I expect that following two lines must behave the same for i > 0:\n{code}\ntableview.insertRowBefore(i, { title: '0' });\ntableview.insertRowAfter(i-1, { title: '0' });\n{code}\nAs for me this is a bug and should be fixed", "updateAuthor": { "name": "akulinich", "key": "akulinich", "displayName": "Andrew Kulinich", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-13T03:08:01.000+0000", "updated": "2011-06-13T03:08:01.000+0000" }, { "id": "159500", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Updated ticket for better formatting and clarity of purpose.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-07-14T08:35:35.000+0000", "updated": "2011-07-14T08:35:35.000+0000" }, { "id": "160924", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "pull # 298 pending", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-27T17:23:48.000+0000", "updated": "2011-07-27T17:23:48.000+0000" }, { "id": "164006", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.8.0.v20110819142548\niPhone 4.3.4\niPad2 4.3.2\nMotorola Xoom 3.2\nNexus One 2.2.2\n", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-25T10:10:24.000+0000", "updated": "2011-08-25T10:10:24.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }