{ "id": "149124", "key": "ALOY-1282", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": "2015-06-25T08:03:01.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "16876", "name": "Alloy 1.6.2", "archived": false, "released": true, "releaseDate": "2015-06-11" } ], "issuelinks": [ { "id": "48194", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "106857", "key": "ALOY-503", "fields": { "summary": "Support Ti.Map.View > Annotation for Model-View binding", "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": "Low", "id": "4" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "batman", "key": "batman", "displayName": "Bruce Wayne", "active": true, "timeZone": "America/New_York" }, "updated": "2015-06-26T08:05:32.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": "13605", "name": "Models" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "The way Map/Annotations data-binding is implemented for ALOY-503 is not working as can be expected from how other data-binding works on other view elements.\r\n\r\nh2. The only way it works\r\nIt only works if you use the {{}} tag and no repeater object. The model attributes must be identical to the property names of the Ti.Map.Annotation object because the generated data-binding will use {{createAnnotation(model.toJSON())}}, or you need to use {{dataTransform}}.\r\n\r\n{code:xml}\r\n\r\n{code}\r\n\r\nh2. dataTransform is used exclusive, with no fallback on model\r\nFor other views, when you use {{dataTransform}} it will fall back to the model attributes when the transformation does not include the required property. This means the transform function only needs to return the fields that have been transformed.\r\n\r\nInstead, for the Map/Annotations data-binding is relies solely on the returned transformation, with no fallback:\r\n\r\n{code:javascript}\r\n for (var i = 0; len > i; i++) {\r\n var __alloyId3 = models[i];\r\n __alloyId2.push(require(\"ti.map\").createAnnotation(transformLocation(__alloyId3)));\r\n }\r\n $.__views.__alloyId1.annotations = __alloyId2;\r\n{code}\r\n\r\nh2. Repeater objects are not supported\r\nYou'd expect to be able/required to use a repeater object, allowing you to map any attribute to any property and set styles via TSS.\r\n\r\n{code:xml}\r\n\r\n \r\n\r\n{code}\r\n\r\nInstead, any annotations in the {{}} tag will be created as is, resulting in code which is likely to crash your app like:\r\n\r\n{code:javascript}\r\n $.__views.__alloyId2 = require(\"ti.map\").createAnnotation({\r\n latitude: 0/0,\r\n longitude: 0/0,\r\n title: \"undefined\" != typeof $model.__transform[\"address\"] ? $model.__transform[\"address\"] : $model.get(\"address\"),\r\n id: \"__alloyId2\"\r\n });\r\n{code}\r\n\r\nh2. Regular view tag is not supported\r\nYou'd expect to be able to use the much nicer {{}} tag, but when you do Alloy won't recognise it as a {{ti.map}} object, which is strange since the {{module}} attribute still says so.\r\n\r\n{code:xml}\r\n\r\n{code}\r\n\r\nInstead, the loop in the collection event listener is empty:\r\n\r\n{code:javascript}\r\n for (var i = 0; len > i; i++) {\r\n var __alloyId3 = models[i];\r\n __alloyId3.__transform = {};\r\n\r\n // NOTHING HERE\r\n\r\n }\r\n{code}", "attachment": [], "flagged": false, "summary": "Ti.Map.View > Annotation data-binding not working as expected", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "Alloy 1.6.2", "comment": { "comments": [ { "id": "356025", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "For repeater objects, I assume the/a reason this wasn't used is that you can also add other types of children views to the map as overlays. Still, in that case we should do something like:\r\n\r\n{code:xml}\r\n\r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nThat way, you could maybe even bind multiple collections to the same map.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-06-26T08:05:32.000+0000", "updated": "2015-06-26T08:05:32.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }