{ "id": "106457", "key": "AC-2245", "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": "2013-04-02T23:51:19.000+0000", "created": "2012-12-13T07:53:36.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:41:14.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I don't know if this is a bug or a weird behavior, but it seems that when creating some Ti.UI objects, custom properties are cloned and not passed by reference.\r\n\r\nHere is a simple test case illustrating the pb:\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n layout: 'vertical',\r\n});\r\n\r\nvar customPropertyValue = {text: \"hello\"};\r\n\r\n// Build a table\r\nvar data = [\r\n\tTi.UI.createTableViewRow({\r\n\t\ttitle: 'Row 1',\r\n\t\tcustomProperty: customPropertyValue,\r\n\t}),\r\n];\r\nvar table = Ti.UI.createTableView({\r\n\t\tdata: data,\r\n});\r\n\r\n// Click events\r\ntable.addEventListener('click', function(e) {\r\n\tTi.API.info('Event ! text=' + e.rowData.customProperty.text);\r\n});\r\nwin.add(table);\r\nwin.open();\r\n\r\n// Modify the property\r\ncustomPropertyValue.text = \"bye\";\r\n{code}\r\n\r\nAs you can see, the customPropertyValue is modified at the end of the code. But when we later click on the row, the displayed message is \"hello\", and not \"bye\".\r\n\r\nSo at the step \"build a table\", it seems that the customPropertyValue is cloned.\r\n", "attachment": [], "flagged": false, "summary": "Custom properties not passed by reference", "creator": { "name": "tmarly", "key": "tmarly", "displayName": "Tristan Marly", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tmarly", "key": "tmarly", "displayName": "Tristan Marly", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK 2.1.4\r\nTested on Emulator Android 4.0.3, Tablet Nexus 10 Android 4.1, iPad Emulator.", "comment": { "comments": [ { "id": "245363", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "For native components the properties are passed by value", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-04-02T23:51:19.000+0000", "updated": "2013-04-02T23:51:19.000+0000" }, { "id": "280986", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Invalid issue. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2013-11-24T22:18:32.000+0000", "updated": "2013-11-24T22:18:32.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }