{ "id": "124372", "key": "TIMOB-16126", "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": "15817", "description": "2014 Sprint 01", "name": "2014 Sprint 01", "archived": true, "released": true, "releaseDate": "2014-01-17" }, { "id": "15820", "description": "2014 Sprint 01 API", "name": "2014 Sprint 01 API", "archived": true, "released": true, "releaseDate": "2014-01-17" }, { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-01-09T20:05:40.000+0000", "created": "2014-01-03T22:19:48.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "index", "listview", "module_listview", "qe-testadded", "support", "supportTeam" ], "versions": [ { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [ { "id": "34366", "type": { "id": "10000", "name": "Blocks", "inward": "is blocked by", "outward": "blocks" }, "inwardIssue": { "id": "124959", "key": "TIMOB-16226", "fields": { "summary": "CLI: Build - In SDK 3.3.0, installing to iOS or Android device returns longjohn error", "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" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-07-23T10:05:06.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": "h3. Issue\r\n\r\nWhen working with the listView user delete a listItem from a section trough a button event bound in the template, after the item is deleted the remaining items will keep the original sectionIndex and itemIndex value, if we try to delete elements from the same section we will start receiving Warning about the item not being in range to be deleted and elements will remain on the listView.\r\n\r\nAlso after deleting a section the delete function stops working, we also notice the index of the listView remains calling elements from one section in another.\r\n\r\nh3. Steps to repro\r\n\r\n1. Run the test code.\r\n2. Click Section 0 title:\"item 0\" label and will be deleted correctly.\r\n3. Click Section 0 title:\"item 1\" label and will delete \"item 2\" as this is located in section 0 item 1 index. \r\n4. Click Section 0 title:\"item 3\" label and will throw a warning.\r\n5. Click Section 1 title:\"item 0\" label deleting the element and section correctly.\r\n6. Click Section 2 title:\"item 0\" label throwing an exception\r\n\r\nh3. Logs\r\n\r\n{quote}\r\n[WARN] : ListView: Delete item index is out of range\r\n{quote}\r\n\r\n{quote}\r\n[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:1330\r\n{quote}\r\n\r\nh3. Test Case\r\n\r\nindex.xml\r\n{code}\r\n\r\n\t\r\n\t\t\r\n \r\n \r\n \r\n\t \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nindex.js\r\n{code}\r\n\r\nfunction doClick(e){\r\n\tTi.API.info('Section: '+e.sectionIndex+' ::: Item: '+e.itemIndex);\r\n\t$.eventsList.sections[e.sectionIndex].deleteItemsAt(e.itemIndex,1);\r\n\tif($.eventsList.sections[e.sectionIndex].items.length == 0){\r\n\t\t\t$.eventsList.deleteSectionAt(e.sectionIndex);\r\n\t\t}\r\n}\r\n\r\n$.index.open();\r\n\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: listView and listItem index not being updated after delete", "creator": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Product: Titanium SDK\r\nTitanium SDK: Mobile 3.1GA 3.2GA\r\nPlatform OS: iOS\r\nPlatform OS Version: 7", "comment": { "comments": [ { "id": "287434", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Common JS test code. To test make sure that the sectionIndex and itemIndex in the click and item click event handlers match. Also ensure that bugs reported above are resolved.\n\n{code}\nvar win = Ti.UI.createWindow({backgroundColor: 'white', fullscreen:true});\n\nfunction delayDelete(e)\n{\n Ti.API.info('DELAY Section: '+e.sectionIndex+' ::: Item: '+e.itemIndex);\n \n}\n\nfunction doClick(e){\n Ti.API.info('CLICK Section: '+e.sectionIndex+' ::: Item: '+e.itemIndex);\n\n if(listView.sections[e.sectionIndex].items.length == 1) {\n listView.deleteSectionAt(e.sectionIndex);\n } else {\n listView.sections[e.sectionIndex].deleteItemsAt(e.itemIndex,1);\n } \n}\n\nvar myTemplate = {\n childTemplates: [\n { // Title \n type: 'Ti.UI.Label', // Use a label for the title \n bindId: 'title', // Maps to a custom info property of the item data\n }\n ],\n events: {click: doClick}\n};\n\nvar listView = Ti.UI.createListView({\n templates: { 'template': myTemplate },\n defaultItemTemplate: 'template'\n});\nvar sections = [];\n\nvar section0 = Ti.UI.createListSection({ headerTitle: 'Section0'});\nvar dataSet0 = [\n { title: {text: 'Item 0'},},\n { title: {text: 'Item 1'},},\n { title: {text: 'Item 2'},},\n { title: {text: 'Item 3'},},\n { title: {text: 'Item 4'},}\n];\nsection0.setItems(dataSet0);\nsections.push(section0);\n\nvar section1 = Ti.UI.createListSection({ headerTitle: 'Section1'});\nvar dataSet1 = [\n { title: {text: 'Item 0'},}\n];\nsection1.setItems(dataSet1);\nsections.push(section1);\n\nvar section2 = Ti.UI.createListSection({ headerTitle: 'Section2'});\nvar dataSet2 = [\n { title: {text: 'Item 0'},},\n { title: {text: 'Item 1'},},\n { title: {text: 'Item 2'},},\n { title: {text: 'Item 3'},}\n];\nsection2.setItems(dataSet2);\nsections.push(section2);\n\nvar section3 = Ti.UI.createListSection({ headerTitle: 'Section3'});\nvar dataSet3 = [\n { title: {text: 'Item 0'},},\n { title: {text: 'Item 1'},},\n { title: {text: 'Item 2'},}\n];\nsection3.setItems(dataSet3);\nsections.push(section3);\n\n\nlistView.setSections(sections);\n\nlistView.addEventListener('itemclick',function(e){\n Ti.API.info('ITEMCLICK Section: '+e.sectionIndex+' ::: Item: '+e.itemIndex);\n \n})\n\nwin.add(listView);\nwin.open();\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-09T18:18:20.000+0000", "updated": "2014-01-09T18:18:20.000+0000" }, { "id": "287439", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending against master\r\nhttps://github.com/appcelerator/titanium_mobile/pull/5199\r\nBackport to 3_2_X\r\nhttps://github.com/appcelerator/titanium_mobile/pull/5200", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-09T18:24:41.000+0000", "updated": "2014-01-09T18:30:03.000+0000" }, { "id": "288687", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-17T22:57:26.000+0000", "updated": "2014-01-17T22:57:26.000+0000" }, { "id": "288936", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed. Verified using both the Alloy sample app and Vishal's sample app that items are being removed correctly and the sectionIndex and itemIndex are being displayed correctly.\n\nTested on:\n\nAppcelerator Studio, build: 3.2.1.201401151647\nSDK build: 3.2.1.v20140117222448, 3.3.0.v20140117222449 \nCLI: 3.2.1 (git://github.com/appcelerator/titanium.git#3_2_X)\nXcode: 5.0.2\nDevices: iphone 5 (6.1.3), iphone 5 (7.0.2)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-21T00:32:17.000+0000", "updated": "2014-01-21T00:32:17.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }