{
"id": "159107",
"key": "ALOY-1478",
"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": "17730",
"name": "Release 5.4.0",
"archived": false,
"released": true,
"releaseDate": "2016-07-05"
},
{
"id": "18066",
"name": "alloy 1.9.0",
"archived": false,
"released": true,
"releaseDate": "2016-04-23"
}
],
"resolution": {
"id": "1",
"description": "A fix for this issue is checked into the tree and tested.",
"name": "Fixed"
},
"resolutiondate": "2016-08-04T00:22:20.000+0000",
"created": "2016-03-29T12:25:26.000+0000",
"priority": {
"name": "High",
"id": "2"
},
"labels": [],
"versions": [
{
"id": "17748",
"name": "alloy 1.7.35",
"archived": false,
"released": true,
"releaseDate": "2016-02-29"
},
{
"id": "17974",
"name": "alloy 1.8.0",
"archived": false,
"released": true,
"releaseDate": "2016-03-16"
}
],
"issuelinks": [
{
"id": "51193",
"type": {
"id": "10011",
"name": "Includes",
"inward": "is included by",
"outward": "includes"
},
"inwardIssue": {
"id": "159167",
"key": "ALOY-1480",
"fields": {
"summary": "Bug/Regression: Data binding always returns string values",
"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": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"updated": "2016-08-04T17:04:38.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"
},
{
"id": "12326",
"name": "XML",
"description": "View XML and parsing"
}
],
"description": "Alloy data binding can't handle complex bindings strings or model attributes names that contain a dash, space or quotes.\r\n\r\nThis is in part because of the way it renders the compiled {{\\_.template()}} code, but also because of limitations in {{\\_.template()}} itself:\r\nhttp://stackoverflow.com/a/15956433/4626813\r\n\r\n{code:xml}\r\n\r\n\t\r\n\t\r\n\t\r\n\t\t\r\n\r\n\t\t\t\r\n\t\t\t\r\n\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\r\n\t\t\t\r\n\t\t\t\t\r\n\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n*index.js*\r\n\r\n{code:js}\r\nvar test = {\r\n a: 'a',\r\n 'a-b': 'a-b',\r\n 'a b': 'a b',\r\n 'a\"b': 'a\"b',\r\n \"a'b\": \"a'b\"\r\n};\r\n\r\nAlloy.Models.mymodel.set(test);\r\nAlloy.Collections.mymodel.reset([test]);\r\n\r\n$.index.open();\r\n{code}\r\n\r\n*mymodel.js*\r\n\r\n{code:js}\r\nexports.definition = {};\r\n{code}",
"attachment": [],
"flagged": false,
"summary": "Data binding fails when binding string or model attribute name has dash, space or quote",
"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": null,
"closedSprints": [
{
"id": 686,
"state": "closed",
"name": "2016 Sprint 16 Tooling",
"startDate": "2016-07-30T00:42:21.509Z",
"endDate": "2016-08-13T00:42:00.000Z",
"completeDate": "2016-08-15T08:01:39.795Z",
"originBoardId": 199
}
],
"comment": {
"comments": [
{
"id": "381181",
"author": {
"name": "fokkezb",
"key": "fokke",
"displayName": "Fokke Zandbergen",
"active": true,
"timeZone": "Europe/Amsterdam"
},
"body": "Wil be done as part of ALOY-1480",
"updateAuthor": {
"name": "fokkezb",
"key": "fokke",
"displayName": "Fokke Zandbergen",
"active": true,
"timeZone": "Europe/Amsterdam"
},
"created": "2016-03-31T14:13:26.000+0000",
"updated": "2016-03-31T14:13:26.000+0000"
},
{
"id": "381219",
"author": {
"name": "fokkezb",
"key": "fokke",
"displayName": "Fokke Zandbergen",
"active": true,
"timeZone": "Europe/Amsterdam"
},
"body": "Combined PR for ALOY-1478, ALOY-1480, ALOY-1481 and ALOY-1482:\r\nhttps://github.com/appcelerator/alloy/pull/780",
"updateAuthor": {
"name": "fokkezb",
"key": "fokke",
"displayName": "Fokke Zandbergen",
"active": true,
"timeZone": "Europe/Amsterdam"
},
"created": "2016-03-31T19:51:00.000+0000",
"updated": "2016-03-31T19:51:00.000+0000"
},
{
"id": "383727",
"author": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"body": "PR merged.",
"updateAuthor": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"created": "2016-04-24T01:32:07.000+0000",
"updated": "2016-04-24T01:32:07.000+0000"
},
{
"id": "392212",
"author": {
"name": "ewieber",
"key": "ewieber",
"displayName": "Eric Wieber",
"active": false,
"timeZone": "America/Los_Angeles"
},
"body": "Reopening as I am unable to use model attributes with dashes, spaces, or quotes in the name when using a collection via the dataCollection property. Tested using:\r\n\r\nMacOS 10.11.5 (15F31a)\r\nTi SDK 5.4.0.v20160801022303\r\nAppc NPM 4.2.7\r\nAppc CLI 5.4.0-37\r\nAlloy 1.9.1\r\nXcode 7.3.1 (7D1014)\r\n\r\nIn the provided code, using a model with dashes, spaces, or quotes in the name is working (simply uncomment the Labels in the scrollview, but outside the listview). However trying to use the dataCollection property and referencing the attributes with spaces, dashes, or quotes in the name will not compile. You can see this by uncommenting the ListItems in the ListSection of the provided code or by using the below example project: (You can make the below project compile by changing the 'dash-dash' and 'space space' attributes in the xml to the 'greeting' and 'subject' attributes)\r\n\r\n*index.xml*\r\n{code}\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n*index.js*\r\n{code}\r\nvar attributes = {\r\n greeting: 'hello',\r\n 'subject': 'world',\r\n 'dash-dash': 'dash',\r\n 'space space': 'space'\r\n};\r\n\r\nAlloy.Models.modelb.set({\r\n 'mix it': 'Mix It!',\r\n deep: {\r\n link: 'deep-link'\r\n }\r\n});\r\n\r\nAlloy.Models['model-a'].set(attributes);\r\nAlloy.Collections['model-a'].reset([attributes]);\r\n\r\n$.index.open();\r\n{code}\r\n\r\n*model-a.js*\r\n{code}\r\nexports.definition = {\r\n extendModel: function(Model) {\r\n _.extend(Model.prototype, {\r\n transform: function() {\r\n var transformed = this.toJSON();\r\n\r\n transformed.subject && (transformed.subject = transformed.subject.toUpperCase());\r\n transformed.font = {\r\n fontSize: 20,\r\n fontWeight: 'bold'\r\n };\r\n\r\n return transformed;\r\n }\r\n });\r\n\r\n return Model;\r\n }\r\n};\r\n{code}\r\n\r\n*modelb.js*\r\n{code}\r\nexports.definition = {};\r\n{code}\r\n\r\nIs this a limitation of _.template() that we cannot overcome? Can this get another look?",
"updateAuthor": {
"name": "ewieber",
"key": "ewieber",
"displayName": "Eric Wieber",
"active": false,
"timeZone": "America/Los_Angeles"
},
"created": "2016-08-02T16:17:17.000+0000",
"updated": "2016-08-02T16:17:17.000+0000"
},
{
"id": "392306",
"author": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"body": "[~ewieber] I looked at this for a bit, the limitation is to use square bracket notation, {{\\[' ']}}, for attributes with properties containing special characters.\r\n\r\n{code}\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n\r\n{code}",
"updateAuthor": {
"name": "fmiao",
"key": "fmiao",
"displayName": "Feon Sua Xin Miao",
"active": true,
"timeZone": "America/Vancouver"
},
"created": "2016-08-03T16:40:41.000+0000",
"updated": "2016-08-03T16:40:41.000+0000"
},
{
"id": "392444",
"author": {
"name": "ewieber",
"key": "ewieber",
"displayName": "Eric Wieber",
"active": false,
"timeZone": "America/Los_Angeles"
},
"body": "Thank you for the second look [~fmiao]. Looking at the first half of the test case, knowing about the square brackets, makes it seem obvious now, but I do not see this notation documented anywhere. [~bimmel], It may be worth noting in the [Alloy Data Binding|http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Data_Binding] docs that the square bracket notation should be used for referencing model attributes with special characters in their names. That said:\r\n\r\nVerified fixed using:\r\nMacOS 10.11.5 (15F31a)\r\nStudio 4.7.0.201607250649\r\nTi SDK 5.4.0.v20160802165655\r\nAppc NPM 4.2.7\r\nAppc CLI 5.4.0-37\r\nAlloy 1.9.1\r\nXcode 7.3.1 (7D1014)\r\n\r\nProjects compile and run correctly when using data binding with models who's attributes contain spaces, dashes, and quotes. Tested using the provided sample code, tests in the Alloy repo (both modified to use the square bracket notation for collections), and personal test apps.",
"updateAuthor": {
"name": "ewieber",
"key": "ewieber",
"displayName": "Eric Wieber",
"active": false,
"timeZone": "America/Los_Angeles"
},
"created": "2016-08-04T17:04:38.000+0000",
"updated": "2016-08-04T17:04:38.000+0000"
}
],
"maxResults": 7,
"total": 7,
"startAt": 0
}
}
}