{ "id": "115531", "key": "ALOY-691", "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": [ { "id": "15758", "description": "Alloy 1.4.0", "name": "Alloy 1.4.0", "archived": false, "released": true, "releaseDate": "2014-07-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-05-22T15:50:18.000+0000", "created": "2013-06-05T16:12:08.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "alloy", "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "37796", "type": { "id": "10011", "name": "Includes", "inward": "is included by", "outward": "includes" }, "outwardIssue": { "id": "129925", "key": "ALOY-1005", "fields": { "summary": "Alloy doesn't care about the platform attr (parent or itself)", "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": "37795", "type": { "id": "10011", "name": "Includes", "inward": "is included by", "outward": "includes" }, "outwardIssue": { "id": "130662", "key": "ALOY-1028", "fields": { "summary": "platform attribute with comma-separated string not correctly applied during build", "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 } } } } ], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2014-05-23T17:32:41.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": "13605", "name": "Models" } ], "description": "Hi,\r\n\r\nwhen using data binding on an element limited to a specific platform, the data function will be created twice. After compiling the example below you will notice the created resource contains two render functions. The render function for iOS and MobileWeb overwrites the function for Android. Calling $.destroy() might break on iOS because the Android related collection is not defined.\r\n\r\nLink to Q&A: http://developer.appcelerator.com/question/153195/alloys-data-binding-feature-does-not-respect-platform-property\r\n\r\nView:\r\n{code}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nController:\r\n{code}\r\n$.index.open(); \r\n \r\nrender();\r\n \r\n$.destroy();\r\n{code}\r\n\r\nModel:\r\n{code}\r\nexports.definition = {\r\n \r\n configuration : {\r\n \"columns\": {\r\n \"username\":\"string\"\r\n },\r\n \"adapter\": {\r\n \"type\": \"sql\",\r\n \"collection_name\": \"test\"\r\n },\r\n },\r\n \r\n extendModel: function(Model) {\r\n \r\n _.extend(Model.prototype, {});\r\n \r\n return Model;\r\n },\r\n \r\n extendCollection: function(Collection) {\r\n \r\n _.extend(Collection.prototype, {});\r\n \r\n return Collection;\r\n }\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "Alloys Data Binding feature does not respect platform property", "creator": { "name": "jicks83", "key": "jicks83", "displayName": "Jick Steen", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "jicks83", "key": "jicks83", "displayName": "Jick Steen", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 112, "state": "closed", "name": "2014 Sprint 10 Alloy", "startDate": "2014-05-12T16:00:00.000Z", "endDate": "2014-05-24T00:00:00.000Z", "completeDate": "2014-05-27T18:12:31.273Z", "originBoardId": 124 } ], "comment": { "comments": [ { "id": "293799", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "PR: https://github.com/appcelerator/alloy/pull/339\n\nFunctional test:\n\nUsing either the sample code provided in the ticket above or in the test app ALOY-691, build the app. Only one copy of render() is included in the generated code.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-02-19T19:25:31.000+0000", "updated": "2014-02-19T19:25:31.000+0000" }, { "id": "294830", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/alloy/pull/342", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-26T19:38:29.000+0000", "updated": "2014-02-26T19:38:29.000+0000" }, { "id": "305169", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening as for android I am seeing two copies of render() in the generated code.\r\nOn iOS & mobileweb, only one copy of render() is seen.\r\n\r\nCode generated for android:\r\n{code}\r\nfunction Controller() {\r\n function render(e) {\r\n if (e && e.fromAdapter) return;\r\n render.opts || {};\r\n var models = __alloyId5.models;\r\n var len = models.length;\r\n var children = $.__views.content.children;\r\n for (var d = children.length - 1; d >= 0; d--) $.__views.content.remove(children[d]);\r\n for (var i = 0; len > i; i++) {\r\n var __alloyId2 = models[i];\r\n __alloyId2.__transform = {};\r\n var __alloyId4 = Ti.UI.createView({});\r\n $.__views.content.add(__alloyId4);\r\n }\r\n }\r\n function render(e) {\r\n if (e && e.fromAdapter) return;\r\n render.opts || {};\r\n var models = __alloyId11.models;\r\n var len = models.length;\r\n var rows = [];\r\n for (var i = 0; len > i; i++) {\r\n var __alloyId6 = models[i];\r\n __alloyId6.__transform = {};\r\n var __alloyId8 = Ti.UI.createTableViewRow({});\r\n rows.push(__alloyId8);\r\n var __alloyId10 = Ti.UI.createView({});\r\n __alloyId8.add(__alloyId10);\r\n }\r\n $.__views.content.setData(rows);\r\n }\r\n{code}\r\n\r\nEnvironment:\r\nAppc Studio : 3.3.0.201405121247\r\nTi SDK : 3.3.0.v20140514163013\r\nMac OSX : 10.8.5\r\nAlloy : 1.4.0-alpha\r\nCLI - 3.3.0-dev\r\nNexus 5 - android 4.4.2", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-05-15T20:34:43.000+0000", "updated": "2014-05-15T20:34:43.000+0000" }, { "id": "305540", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "New PR https://github.com/appcelerator/alloy/pull/401 submitted and merged", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-19T17:37:57.000+0000", "updated": "2014-05-19T17:37:57.000+0000" }, { "id": "305930", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Reopening because my last implementation didn't work properly when an element was tagged to support multiple platforms.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-21T16:08:49.000+0000", "updated": "2014-05-21T16:08:49.000+0000" }, { "id": "306078", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "New PR https://github.com/appcelerator/alloy/pull/410\r\n\r\nMerged to 1_4_X and master\r\n\r\nProperly prevents the processing of children (e.g. TableViewRows) of tags not for the current platform (e.g. TableView). \r\n\r\nTest app https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-691", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-22T15:50:18.000+0000", "updated": "2014-05-22T15:50:18.000+0000" }, { "id": "306129", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed and working as expected with the latest sample code and fix. \r\nClosing.\r\n\r\nTiSDK 3.3.0.v20140522110830\r\nAlloy 1.4.0-alpha4\r\nAppcelerator Studio 3.3.0.201405211748\r\nCLI 3.3.0-alpha5\r\n\r\niOS Compiled code :\r\n{code}\r\nfunction render(e) {\r\n if (e && e.fromAdapter) return;\r\n render.opts || {};\r\n var models = __alloyId7.models;\r\n var len = models.length;\r\n var rows = [];\r\n for (var i = 0; len > i; i++) {\r\n var __alloyId2 = models[i];\r\n __alloyId2.__transform = {};\r\n var __alloyId4 = Ti.UI.createTableViewRow({});\r\n rows.push(__alloyId4);\r\n var __alloyId6 = Ti.UI.createView({});\r\n __alloyId4.add(__alloyId6);\r\n }\r\n $.__views.content.setData(rows);\r\n }\r\n{code}\r\n\r\nAndroid Compiled code:\r\n{code}\r\n function render(e) {\r\n if (e && e.fromAdapter) return;\r\n render.opts || {};\r\n var models = __alloyId5.models;\r\n var len = models.length;\r\n var children = $.__views.content.children;\r\n for (var d = children.length - 1; d >= 0; d--) $.__views.content.remove(children[d]);\r\n for (var i = 0; len > i; i++) {\r\n var __alloyId2 = models[i];\r\n __alloyId2.__transform = {};\r\n var __alloyId4 = Ti.UI.createView({});\r\n $.__views.content.add(__alloyId4);\r\n }\r\n }\r\n{code}", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-05-22T20:12:20.000+0000", "updated": "2014-05-22T20:12:20.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }