[AC-1952] Custom properties in TitaniumUI components
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2013-05-02T17:59:02.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | Jacek H. |
| Assignee | Carter Lathrop |
| Created | 2013-05-02T12:56:55.000+0000 |
| Updated | 2016-03-08T07:40:53.000+0000 |
You are not able to directly change the value of an object property, this is one caveat of using custom properties. Take for example:
You cannot directly change the location value. In order to change it you must do:// app.js mywindow.userInfo = { id: 1, name: 'John Doe', location: 'Neverland' }; mywindow.userInfo.location = "Wonderland"; alert(mywindow.userInfo.location); // still "Neverland"for more information please take a look at this page: http://shikii.net/blog/custom-properties-in-titanium-windows-and-controls/ If you have any more questions, feel free to ask. Regards, CarterOk, thanks for the quick response. The behavior of the custom properties is a bit strange. I found this solution to give/set references: // app.js var userInfo = { id: 1, name: 'John Doe', location: 'Neverland' }; mywindow.getUserInfo = function() { return userInfo; } mywindow.setUserInfo = function(property, value) { userInfo[property] = value; } userInfo.location = "Wonderland"; alert(mywindow.getUserInfo().location); // "Wonderland" Regards Jacek
Closing as per Jacek's update.