{ "id": "79384", "key": "TIMOB-5035", "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": "15108", "description": "2013 Sprint 10", "name": "2013 Sprint 10", "archived": true, "released": true, "releaseDate": "2013-05-20" } ], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2013-05-09T05:03:17.000+0000", "created": "2011-08-17T13:09:32.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "insertafter", "insertbefore", "ios", "table_view", "tableviewrow" ], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [], "assignee": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T22:21:49.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": "h5.Problem\r\nIt looks like 'insertRowBefore' is 1-index-based, insertRowBefore(1) will insert a row before the row at position 0 (first item).\r\n\r\nSo it would be expected insertRowBefore(1) to insert a row before the row at position 1 (see screenshot attached).\r\n\r\nh5.Repro Sequence\r\n{code:title=app.js}\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\n// create tab group\r\nvar tabGroup = Titanium.UI.createTabGroup();\r\n\r\n//\r\n// create base UI tab and root window\r\n//\r\nvar win1 = Titanium.UI.createWindow({\r\n\ttitle : 'Tab 1',\r\n\tbackgroundColor : '#fff'\r\n});\r\nvar tab1 = Titanium.UI.createTab({\r\n\ticon : 'KS_nav_views.png',\r\n\ttitle : 'Tab 1',\r\n\twindow : win1\r\n});\r\n\r\n//\r\n// create controls tab and root window\r\n//\r\nvar win2 = Titanium.UI.createWindow({\r\n\ttitle : 'Tab 2',\r\n\tbackgroundColor : '#fff'\r\n});\r\nvar tab2 = Titanium.UI.createTab({\r\n\ticon : 'KS_nav_ui.png',\r\n\ttitle : 'Tab 2',\r\n\twindow : win2\r\n});\r\n\r\n//\r\n// add tabs\r\n//\r\ntabGroup.addTab(tab1);\r\ntabGroup.addTab(tab2);\r\n\r\nvar table = Ti.UI.createTableView({\r\n});\r\n\r\nvar i, len = 2;\r\nvar rows = [];\r\nvar row;\r\n\r\nfor( i = 0; i <= len; i++) {\r\n\trow = Ti.UI.createTableViewRow({\r\n\t\theight : 50,\r\n\t\tclassName : 'tableRow',\r\n\t\ttouchEnabled : true,\r\n\t\tfocusable : true, \r\n\t});\r\n\trow.add(Ti.UI.createLabel({\r\n\t\ttext : 'Row ' + i\r\n\t}));\r\n\trows.push(row);\r\n};// For\r\n\r\ntable.setData(rows);\r\nwin1.add(table);\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttitle : 'Add Row - insertRowBefore 1',\r\n\ttop : 25,\r\n\theight : 25\r\n});\r\n\r\nbutton.addEventListener('click', function() {\r\n\tvar newRow1 = Ti.UI.createTableViewRow({\r\n\t\theight : 50,\r\n\t\tclassName : 'tableRow',\r\n\t\ttouchEnabled : true,\r\n\t\tfocusable : true\r\n\t});\r\n\t\r\n\tnewRow1.add(Ti.UI.createLabel({\r\n\t\ttext : 'New Row inserted before position 1'\r\n\t}));\r\n\t\r\n\ttable.insertRowBefore(1, newRow1);\t\r\n});\r\n\r\nwin2.add(button);\r\n\r\nvar button2 = Ti.UI.createButton({\r\n\ttop: 125, height:25, title : 'Add Row - insertRowAfter 1',\r\n});\r\n\r\nbutton2.addEventListener('click',function(){\r\n\t\tvar newRow2 = Ti.UI.createTableViewRow({\r\n\t\theight : 50,\r\n\t\tclassName : 'tableRow',\r\n\t\ttouchEnabled : true,\r\n\t\tfocusable : true\r\n\t});\r\n\tnewRow2.add(Ti.UI.createLabel({\r\n\t\ttext : 'New Row inserted After position 1'\r\n\t}));\r\n\r\n\ttable.insertRowAfter(1, newRow2);\r\n});\r\n\r\nwin2.add(button2);\r\n\r\n// open tab group\r\ntabGroup.open();\r\n\r\n\r\ntable.addEventListener('click', function(e)\r\n{\r\n\tvar myIndex = e.index;\r\n\tTi.API.info('Current Indices: '+ myIndex);\r\n});\r\n{code}\r\n\r\nh5.Console output\r\nClicked the Table view Rows in order to retrieve current indices\r\n{noformat}\r\n[INFO] Current Indices: 0\r\n\r\n[INFO] Current Indices: 1\r\n\r\n[INFO] Current Indices: 2\r\n{noformat}\r\n\r\nh5.Associated HD ticket\r\nhttp://appc.me/c/APP-341733\r\n", "attachment": [ { "id": "40057", "filename": "iOS Simulator Screen shot Jun 20, 2013 3.13.01 PM.png", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-20T09:40:46.000+0000", "size": 20715, "mimeType": "image/png" }, { "id": "38281", "filename": "iOS Simulator Screen shot May 8, 2013 10.34.54 PM.png", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-09T05:05:13.000+0000", "size": 18092, "mimeType": "image/png" }, { "id": "22600", "filename": "Rows.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-08-17T13:09:32.000+0000", "size": 38437, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "iOS: TableView insertRowBefore index", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Product: Mobile SDK: Mobile 1.7.2\r\nPlatform OS: iOS Version: 4.2", "comment": { "comments": [ { "id": "250939", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "cannot reproduce\r\n\r\nTested with\r\nTitanium Studio, build: 3.0.1.201212181159\r\nTitanium SDK version: 3.1.0\r\niOS iPhone Simulator: iOS SDK version: 6.0", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-09T05:03:17.000+0000", "updated": "2013-05-09T05:03:17.000+0000" }, { "id": "258707", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Issue does not reproduces\n\nTested with\n\niOS SDK: 5.1\niOS iPhone Simulator: 5.1\nMac OS X Version 10.7.5\nTitanium SDK version 3.1.1.v20130606121419\nTitanium Studio, build: 3.0.1.201212181159\n", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-20T09:40:22.000+0000", "updated": "2013-06-20T09:40:22.000+0000" }, { "id": "414568", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as the issue cannot be reproduced and due to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T22:21:49.000+0000", "updated": "2017-03-21T22:21:49.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }