{ "id": "145195", "key": "AC-1681", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "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": "2015-09-29T03:00:03.000+0000", "created": "2015-02-26T16:56:54.000+0000", "labels": [ "defect", "ios", "iphone" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:38:10.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Hi, \r\n\r\nI've been having an issue with the code from https://gist.github.com/rileydutton/946647, which I have slightly modified, as shown below in the code. \r\n\r\nBasically the code works fine, when you click parent 2, however if you do the following:\r\n1) on app load click parent 2\r\n2) click parent 1\r\n3) then click parent 2 a few times\r\nyou are shown an error, stating: 'no row found for index'\r\n\r\nI have also noticed that if you dismiss the message, a new row called with the title 'child' and a number(comes from the sub collection) is present, and the error is no longer thrown while this is shown. \r\n\r\nCode: \r\n--------------------------------------------------------------------------------------------------\r\n{code:javascript}\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\nvar win1 = Titanium.UI.createWindow({\r\n\ttitle : 'Tab 1',\r\n\tbackgroundColor : '#fff'\r\n});\r\nvar activeWindow = win1;\r\nvar layout = [{\r\n\ttitle : \"Parent 1\",\r\n\t_isParent : true,\r\n\t_isOpen : false,\r\n\tsub : [{\r\n\t\ttitle : \"Child 1\"\r\n\t}, {\r\n\t\ttitle : \"Child 2\"\r\n\t}]\r\n}, {\r\n\ttitle : \"Parent 2\",\r\n\t_isParent : true,\r\n\t_isOpen : false,\r\n\tsub : [{\r\n\t\ttitle : \"Child 3\"\r\n\t}, {\r\n\t\ttitle : \"Child 4\"\r\n\t}]\r\n}];\r\nvar tableView = Ti.UI.createTableView({\r\n\tstyle : Titanium.UI.iPhone.TableViewStyle.GROUPED,\r\n\ttop : 0,\r\n\theight : Ti.Platform.displayCaps.platformHeight,\r\n\tdata : layout\r\n});\r\n\r\ntableView.addEventListener(\"click\", function(e) {\r\n\r\n\t//Is this a parent cell?\r\n\tif (e.row._isParent) {\r\n\r\n\t\t// check to see if the row is open\r\n\t\tif (e.row._isOpen) {\r\n\t\t\tfor (var i = e.row.sub.length; i > 0; i = i - 1) {\r\n\t\t\t\ttableView.deleteRow(e.index + i);\r\n\t\t\t}\r\n\t\t\te.row._isOpen = false;\r\n\t\t} else {\r\n\t\t\t// Add the children.\r\n\t\t\tvar currentIndex = e.index;\r\n\t\t\tfor (var i = 0; i < e.row.sub.length; i++) {\r\n\t\t\t\ttableView.insertRowAfter(currentIndex, e.row.sub[i]);\r\n\t\t\t\tcurrentIndex++;\r\n\t\t\t}\r\n\t\t\te.row._isOpen = true;\r\n\t\t}\r\n\r\n\t}\r\n\r\n});\r\n\r\nactiveWindow.add(tableView);\r\nactiveWindow.open();\r\n{code}\r\n\r\n\r\n\r\n", "attachment": [ { "id": "54263", "filename": "Screen Shot 2015-02-26 at 16.45.14.png", "author": { "name": "reillydom", "key": "reillydom", "displayName": "Dom Reilly", "active": true, "timeZone": "Europe/London" }, "created": "2015-02-26T16:56:54.000+0000", "size": 67834, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: TableView insertRowAfter throws error on last index", "creator": { "name": "reillydom", "key": "reillydom", "displayName": "Dom Reilly", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "reillydom", "key": "reillydom", "displayName": "Dom Reilly", "active": true, "timeZone": "Europe/London" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.10.2\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 17179869184\r\nNode.js\r\n Node.js Version = 0.10.35\r\n npm Version = 1.4.28\r\nTitanium CLI\r\n CLI Version = 3.4.1\r\nTitanium SDK\r\n SDK Version = 3.5.0.GA\r\nSupport/Titanium/mobilesdk/osx/3.5.0.GA\r\n Target Platform = iphone", "comment": { "comments": [ { "id": "360648", "author": { "name": "pchowdhury", "key": "pchowdhury", "displayName": "Papia Chowdhury", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\n\r\nI have retested this issue with the latest environment and this is not a bug anymore.\r\n\r\n*Testing Environment:*\r\nAppcelerator Studio, build: 4.2.0.201508141038\r\nTitanium SDK: 4.1.0 GA\r\niOS simulator: iphone 5s(v8.1)\r\nOS X version: 10.9.5\r\n\r\n*Test Case:*\r\napp.js\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor : '#000'\r\n});\r\nvar Data = [{\r\n title : \"Parent 1\",\r\n}, {\r\n title : 'Parent 2',\r\n}];\r\nvar table = Ti.UI.createTableView({\r\n data : Data,\r\n});\r\nvar value = true;\r\nvar value1 = true;\r\ntable.addEventListener('click', function(e) {\r\n switch(e.rowData.title) {\r\n case 'Parent 1':\r\n if (value) {\r\n var row = Ti.UI.createTableViewRow(); \r\n \tvar label1 = Ti.UI.createLabel({\r\n text : 'Child 1',\r\n color : 'red',\r\n left : 45,\r\n \r\n });\r\n row.add(label1);\r\n table.insertRowAfter(e.index, row);\r\n value = false;\r\n break;\r\n } else {\r\n table.deleteRow(e.index + 1);\r\n value = true;\r\n break;\r\n }\r\n case 'Parent 2':\r\n if (value1) {\r\n var row = Ti.UI.createTableViewRow();\r\n \r\n var label2 = Ti.UI.createLabel({\r\n text : 'Child 2',\r\n color : 'red',\r\n left: 45\r\n });\r\n row.add(label2);\r\n \r\n table.insertRowAfter(e.index, row);\r\n value1 = false;\r\n break;\r\n } else {\r\n table.deleteRow(e.index + 1);\r\n value1 = true;\r\n break;\r\n }\r\n }\r\n});\r\nwin.add(table);\r\nwin.open();\r\n{code}\r\n\r\nThanks.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-08-21T08:09:23.000+0000", "updated": "2015-09-29T02:59:39.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }