{ "id": "140778", "key": "ALOY-1193", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-12-02T16:57:12.000+0000", "created": "2014-12-02T04:20:05.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "alloy", "runnable", "runtime", "style" ], "versions": [], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2018-03-07T22:28:29.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": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" } ], "description": "Alloy: Changing Style in JS doesn't work for dynamically created views\r\n\r\nAttached the test case to reproduce problem.\r\n\r\nh6.Reproduce:\r\n1.Run the app device or simulator. (Do no click \"Go to Dashboard first\")\r\n2.Click the \"setNewsGothicSBOP\" button to set some Alloy.Global Properties.\r\n3.Click \"Go to Dashboard\", view the Label style is same.\r\n4.Click \"Change\", then choose \"setCordiaNew\" button to re-set those Alloy.Global Properties.\r\n5.Click \"Go to Dashboard\" again.\r\n\r\nh6.Expect Result:\r\nAll labels should change to apply new style.\r\n\r\nh6.Actual Result:\r\nOnly the labels defined in XML apply the new style, those views(Labels) created in JS did not apply the new style.\r\n\r\nN.B.\r\nProblem occurs in both IOS and Android devices\r\n", "attachment": [ { "id": "52941", "filename": "TestCase.zip", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-12-02T04:27:00.000+0000", "size": 3729, "mimeType": "application/zip" } ], "flagged": false, "summary": "Alloy: Changing Style in JS doesn't work for dynamically created views", "creator": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "subtasks": [], "reporter": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "environment": "Alloy 1.5\r\nTitanium SDK 3.4.1\r\nIOS 8.1\r\nAndroid 4.2.2", "comment": { "comments": [ { "id": "334297", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "Only attached controller, view and style folders.", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-12-02T04:27:00.000+0000", "updated": "2014-12-02T04:27:00.000+0000" }, { "id": "334345", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Alloy is a preprocessor. Your TSS file is being parsed and processed at compile time, at which point Alloy.Globals.regularFont is undefined. Therefore, you get the default system font. Furthermore, you are attempting to use dynamic styling without adding {{autoStyle=true}} to the component's tag in the XML. ", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-12-02T16:57:12.000+0000", "updated": "2014-12-02T16:57:12.000+0000" }, { "id": "334457", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "[~skypanther], Sorry, still not follow why the label.width and font changing is applied by XML file, not JS file. Do you mean TSS file is being parsed and processed at compile time, can't change it during runtime? if yes, why XML file get applied.", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-12-03T01:39:32.000+0000", "updated": "2014-12-03T01:39:32.000+0000" }, { "id": "334550", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "If you define style selectors, but never apply them, they will be optimized out of the generated code. ", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-12-03T17:17:08.000+0000", "updated": "2014-12-03T17:17:08.000+0000" }, { "id": "335807", "author": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "body": "I agree with Tim, you're mixing methods here - both classes that have been already defined in the pre-processing to applying them in dynamic JS.\r\n\r\nIf you create two classes, one with the old font and one with the new font, then apply these using $.addClass or createStyle then it works fine.\r\n", "updateAuthor": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "created": "2014-12-10T10:35:50.000+0000", "updated": "2014-12-10T10:35:50.000+0000" }, { "id": "435363", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as invalid. If this is incorrect, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-03-07T22:28:29.000+0000", "updated": "2018-03-07T22:28:29.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }