{ "id": "128818", "key": "AC-1556", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-04-23T03:27:30.000+0000", "created": "2014-04-08T20:29:58.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "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": "dataTransform seems to be ignored at all when instance (or singleton) model attributes are bound to views (the Ti.API info doesn't print anything in the console):\r\n\r\nindex.html\r\n{code:xml}\r\n\r\n\t\r\n\t\r\n\t\t\r\n\r\n{code}\r\n\r\nindex.js\r\n{code:javascript}\r\nfunction buildFullName(model) {\r\n\tTi.API.info(\"trasformation has been called\");\r\n\treturn {\r\n\t\tname: model.attributes.name,\r\n\t\tfullname: model.attributes.name + \" \" + model.attributes.surname,\r\n\t\tsurname: model.attributes.surname\r\n\t};\r\n};\r\n\r\n$.aPerson.set({\r\n\tname: \"Steve\",\r\n\tsurname: \"Jobs\"});\t\r\n\t\r\n\r\n$.index.open();\r\n\r\n{code}\r\n\r\nMoreover in the code generated by alloy in the index.js I see duplication:\r\n{code:javascript}\r\n var __alloyId3 = function() {\r\n $.__alloyId0.text = _.isFunction($.aPerson.transform) ? $.aPerson.transform()[\"name\"] : $.aPerson.get(\"name\");\r\n $.__alloyId0.text = _.isFunction($.aPerson.transform) ? $.aPerson.transform()[\"name\"] : $.aPerson.get(\"name\");\r\n $.__alloyId1.text = _.isFunction($.aPerson.transform) ? $.aPerson.transform()[\"surname\"] : $.aPerson.get(\"surname\");\r\n $.__alloyId1.text = _.isFunction($.aPerson.transform) ? $.aPerson.transform()[\"surname\"] : $.aPerson.get(\"surname\");\r\n $.__alloyId2.text = _.isFunction($.aPerson.transform) ? $.aPerson.transform()[\"fullname\"] : $.aPerson.get(\"fullname\");\r\n $.__alloyId2.text = _.isFunction($.aPerson.transform) ? $.aPerson.transform()[\"fullname\"] : $.aPerson.get(\"fullname\");\r\n };\r\n{code}\r\n", "attachment": [ { "id": "47189", "filename": "app.zip", "author": { "name": "acaland", "key": "acaland", "displayName": "Antonio Calanducci", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-04-08T20:29:58.000+0000", "size": 5903321, "mimeType": "application/zip" } ], "flagged": false, "summary": "Instance Model-View Binding dataTransform attributed ignored ", "creator": { "name": "acaland", "key": "acaland", "displayName": "Antonio Calanducci", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "acaland", "key": "acaland", "displayName": "Antonio Calanducci", "active": true, "timeZone": "Europe/Berlin" }, "environment": "OS X 10.9.2\r\nTitanium SDK 3.2.2.GA\r\niOS SDKs 7.1 (Xcode 5.1)", "comment": { "comments": [ { "id": "301298", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Transforms on a bound model like this aren't supported. There is a workaround to accomplish what you're trying to do with your function. Add an id attribute to your full name label. Then, add this to your controller:\n\n{code}\n$.aPerson.on('change', function(model){\n $.fullname.text = model.attributes.name + \" \" + model.attributes.surname;\n});\n{code}\n\nModels and collections are going to be reworked in Alloy 2.0. So, this ticket could be a feature request, but it might not get attention until then.\n\nAs for the duplicated code on output, that should be resolved once we implement the support for dataTransform on models.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-04-17T20:17:20.000+0000", "updated": "2014-04-17T20:17:20.000+0000" }, { "id": "302115", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Resolving this ticket as invalid as transforms on a bound model like this aren't supported.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-23T03:27:30.000+0000", "updated": "2014-04-23T03:27:30.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }