{ "id": "132557", "key": "AC-1564", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-07-29T06:52:01.000+0000", "created": "2014-07-03T04:51:02.000+0000", "labels": [ "core", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:38:01.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": "14544", "name": "Alloy", "description": "Please enter tickets related to the Alloy here." } ], "description": "h2. Issue\r\nCollection instance binding does not work properly.\r\n\r\nh2. Expected Result\r\nAll Models should be displaying in the ListView\r\n\r\nh2. Actual Result\r\nOnly the last added model is showing in the ListView\r\n\r\nModel\r\n{code:title=adidas.js}\r\nexports.definition = {\r\n config : {\r\n columns : {\r\n \"id\" : \"INTEGER PRIMARY KEY AUTOINCREMENT\",\r\n \"name\" : \"STRING\"\r\n },\r\n adapter : {\r\n type : \"sql\",\r\n idAttribute : \"id\",\r\n collection_name : \"adidas\"\r\n }\r\n }\r\n};\r\n{code}\r\n\r\nController\r\n{code:title=index.js}\r\nvar i = 5;\r\nwhile (i > 0) {\r\n var model = Alloy.createModel(\"adidas\", {\r\n \"name\" : \"CRAZY LIGHT FOUR\" + i\r\n });\r\n \r\n // add model to collection which will in turn update the UI\r\n $.sports.add(model);\r\n // save the model to SQLite\r\n model.save();\r\n i--;\r\n}\r\n \r\n \r\n$.sports.fetch();\r\n \r\n \r\nTi.API.info($.sports.toJSON());\r\n \r\n$.index.open();\r\n{code}\r\n\r\nView\r\n{code:title=index.xml}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}", "attachment": [], "flagged": false, "summary": " Alloy - collection instance does not work properly on ListView data binding? ", "creator": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS 7.1\r\nAlloy 1.4.0\r\nTiSDK 3.2.3", "comment": { "comments": [ { "id": "312507", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hi \r\n It's not a bug. It's working as expected. You just need to change something in your index.xml file. The following code is the solution. DataCollection is not window object. it should be set in listview. \r\nh2.Testing Environment:\r\nTitanium SDK: 3.2.3, 3.3.0.RC,\r\nTitanium CLI: 3.3.0 –rc,\r\niOS SDK: 7.1\r\nAlloy: 1.4.0\r\nOS X Version: 10.9.3,\r\nAppcelerator Studio: 3.2.3\r\n\r\nh2.Test Code\r\n{code:title=index.xml}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-07-07T08:05:51.000+0000", "updated": "2014-07-29T06:51:47.000+0000" }, { "id": "316102", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Fixed in 3.3.0.GA. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-07-29T06:52:01.000+0000", "updated": "2014-07-29T06:52:01.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }