{ "id": "112582", "key": "ALOY-614", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2013-04-09T15:07:26.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [ { "id": "28308", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "113640", "key": "ALOY-647", "fields": { "summary": "Allow complex data binding on ListView for sections and items", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": null, "updated": "2018-03-07T22:25:48.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "h2. Problem\r\n\r\nWould like to be able to dynamically set the dataCollection for a UI element. In this way we can use a single view/controller to output a different collection of data.\r\n\r\nh2. Test case\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar tab = null;\r\n\r\nexports.openMainWindow = function(_tab,_title,_collection){\r\n\ttab = _tab;\r\n\t$.win.title = _title;\r\n\tvar collection = Alloy.Collections[_collection];\r\n\tcollection.fetch();\r\n\t$.tab.dataCollection = collection;\r\n\t_tab.open($.win);\r\n}\r\n\r\nvar goNext = function(e){\r\n\tif(e.source.custom.length>0){\r\n\t\tvar subControl = Alloy.createController(e.source.custom);\r\n\t} else if(e.source.nextCollection.length>0) {\r\n\t\tvar subControl = Alloy.createController('table');\r\n\t\tsubControl.openMainWindow(tab,e.source.title,e.source.nextCollection);\r\n\t}\r\n\t\r\n}\r\n\r\n$.tab.addEventListener('click', goNext);\r\n{code}\r\n\r\nh2. Discussions\r\n\r\nhttp://developer.appcelerator.com/question/150685/dynamic-collection-for-view#comment-167341", "attachment": [], "flagged": false, "summary": "Dynamic DataCollection for UI", "creator": { "name": "nthurston", "key": "nthurston", "displayName": "Nicholas Thurston", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }