{ "id": "109316", "key": "TIMOB-12606", "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": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "15274", "description": "2013 Sprint 06 API", "name": "2013 Sprint 06 API", "archived": true, "released": true, "releaseDate": "2013-03-25" }, { "id": "14816", "description": "2013 Sprint 06", "name": "2013 Sprint 06", "archived": true, "released": true, "releaseDate": "2013-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-03-18T18:58:38.000+0000", "created": "2013-02-06T17:32:03.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios", "module_dashboardview", "qe-testadded" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "25567", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "109318", "key": "ALOY-500", "fields": { "summary": "Fix models/binding_dashboard app after TIMOB-12606 is resolved", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "25568", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "108092", "key": "ALOY-471", "fields": { "summary": "Enable Collection binding for DashboardView", "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" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-09-27T09:30:48.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": "h2. problem\r\n\r\nWhen calling Ti.UI.DashboardView.setData(), one would expect, like with Ti.UI.TableView, that the data given to the function call would reset the DashboardView. The problem is that instead of reseting it with the given array of DashboardItems, it instead appends the array to the existing list of data. This essentially leaves developers with no programmatic way to reset or remove items from the DashboardView. The remove() function operates on Views added to the Dashboard's view hierarchy, not its collection of items and will not work on DashboardItems.\r\n\r\nThis creates an issue with applications that contain a data model that describes the items. This existed originally in this Q&A question (unresolved): http://developer.appcelerator.com/question/92191/bug-in-dashboardview-when-adding-view-items\r\n\r\nAdditionally, this is a problem for Alloy when it comes to data binding. Developers in Alloy should be able to define their DashboardItems as a collection and use binding to control the appearance of the DashboardView. As of now this is not possible and will cause unexpected behavior.\r\n\r\nh2. test case\r\n\r\n# Create a new Titanium mobile project\r\n# Run the following code for iOS (iphone sim is what I tested):\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#fff'\r\n});\r\n\r\nvar data = [];\r\ndata.push(Ti.UI.createDashboardItem({\r\n\timage: 'KS_nav_ui.png',\r\n\tbadge: 10,\r\n\tlabel: 'test1',\r\n\tcustomId: 'id1'\t\r\n}));\r\ndata.push(Ti.UI.createDashboardItem({\r\n\timage: 'KS_nav_views.png',\r\n\tbadge: 99,\r\n\tlabel: 'test2',\r\n\tcustomId: 'id2'\t\r\n}));\r\n\r\nvar dash = Ti.UI.createDashboardView({\r\n\twobble: true,\r\n\tdata: data\r\n});\r\ndash.addEventListener('click', function(e) {\r\n\tfor (var i = 0; i < data.length; i++) {\r\n\t\tif (data[i].customId === e.item.customId) {\r\n\t\t\tdata[i].badge = 0;\t\r\n\t\t} \r\n\t}\r\n\tdash.data = data; // appends data, does not reset it\r\n\t// dash.setData(data); // this doesn't work either\r\n});\r\n\r\nwin.add(dash);\r\nwin.open();\r\n{code}\r\n# Click a DashboardItem. It should set the badge to zero. It instead appends all the items again, having unexpected behavior with its re-rendering as well as with the resulting badge numbers.", "attachment": [], "flagged": false, "summary": "Ti.UI.DashboardView.setData() appends to dataset, it doesn't actually reset it", "creator": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "TiSDK 3.0.0.GA\r\niOS 6", "comment": { "comments": [ { "id": "242130", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/3964", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-14T00:17:16.000+0000", "updated": "2013-03-14T00:17:16.000+0000" }, { "id": "242721", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pull merged.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-18T18:58:38.000+0000", "updated": "2013-03-18T18:58:38.000+0000" }, { "id": "243386", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with: \r\nSDK:3.1.0.v20130319222852\r\nStudio: 3.0.2.201302191606\r\nDevice: iPad2(v 5.1)\r\n", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-21T11:00:43.000+0000", "updated": "2013-03-21T11:00:43.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }