{ "id": "91589", "key": "TIMOB-9054", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "13273", "description": "Release 2.0.2", "name": "Release 2.0.2", "archived": false, "released": true, "releaseDate": "2012-05-31" }, { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13406", "description": "Sprint 2012-10 API", "name": "Sprint 2012-10 API", "archived": true, "released": true, "releaseDate": "2012-05-20" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-07-11T02:02:34.000+0000", "created": "2012-05-08T10:38:02.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "api", "module_view", "qe-testadded", "regression" ], "versions": [ { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" } ], "issuelinks": [], "assignee": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-07T05:51:25.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h4. Problem Description\r\nWhen processing custom events, the source of the event is not passing complete. This used to work in SDK 1.7.6.\r\n\r\nh4. Actual Results\r\nThe source of the event is not complete, so it's failing.\r\n\r\nh4. Expected results \r\nThe events working as before\r\n\r\nh4. Test Case\r\n1. Create a new mobile Project\r\n2. PAste this:\r\n{code}\r\nvar fundListSize,fundCheckboxArray=[],fundsToPlotCount,grey=false,lightBlue=false,clickEvent=false,fundsSitemanagerMsg=null;\r\nvar win = createHistoricalFundGraphFundsWindow();\r\nwin.orientationModes = [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];\r\nwin.open()\r\n \r\n/*\r\n * Function to display the available funds that can be selected to display on the graph\r\n */\r\nfunction createHistoricalFundGraphFundsWindow() {\r\n\t/* Declaring the variables*/\r\n\tvar iOSTopTitle, planText, navTitleText, menuTitle, winLeftNavButton, winRightNavButton, winBackButtonTitle, winBackButtonTitleImage, winTabBarHidden, subHeader, tableViewDS, genericTableView, win;\r\n\tfundsSitemanagerMsg = ''//_response.historicalFundGraphFundMessage;\r\n\tfundsToPlotCount = 3;\r\n\r\n /* reset fundlistsize*/\r\n\tfundListSize = 0;\r\n \r\n\ttableViewDS = createHistoricalFundGraphFundsTableViewDS();\r\n\tgenericTableView = Titanium.UI.createTableView({\r\n\t\tseparatorColor:'#e7e7e7',\r\n\t\tdata : tableViewDS,\r\n\t\tbackgroundColor :'#e7e7e7'\r\n\t});\r\n \r\n\tgenericTableView.top = 0;\r\n\tgenericTableView.backgroundColor = '#e7e7e7';\r\n\ttableViewDS = null;\r\n \r\n\tvar menuWindow = Titanium.UI.createWindow({\r\n\t\tbarColor : '#929292',\r\n\t\tbackgroundColor : '#E7E7E7'\r\n\t});\r\n \r\n\tmenuWindow.add(genericTableView);\r\n\treturn menuWindow;\r\n};\r\n \r\n/*\r\n * Function to create the data source to be added to the tableview that displays the funds\r\n */\r\nfunction createHistoricalFundGraphFundsTableViewDS() {\r\n\tvar responseLength=2;\r\n\tvar datasource=[];\r\n\tvar datasourceChecked=[];\r\n\tvar fundRow,boxChecked;\r\n\tboxChecked=false;\r\n\tfundCheckboxArray.push(createHFGCheckBox('','xyz',boxChecked));\r\n\tfundCheckboxArray.push(createHFGCheckBox('','abc',boxChecked));\r\n\tfundRow=createHFGRowLndScpe({\r\n\t\tfFundName: 'xyz',\r\n\t\tsSwitch: fundCheckboxArray[0]\r\n\t});\r\n\tvar fundRow1=createHFGRowLndScpe({\r\n\t\tfFundName: 'abc',\r\n\t\tsSwitch: fundCheckboxArray[1]\r\n\t});\r\n\r\n\tdatasource.push(fundRow);\r\n\tdatasource.push(fundRow1);\r\n\tfundListSize = 2;\r\n\treturn datasource;\r\n};\r\n/*\r\n * function to create checkbox ( a button masked as checkbox, not a switch ) for each row\r\n */\r\nfunction createHFGCheckBox(_fundNum,_fundName,_checked) {\r\n \r\n\tvar checkbox = Ti.UI.createButton({\r\n\t\ttitle:'',\r\n\t\tright:'5%',\r\n\t\twidth:28,\r\n\t\theight:28,\r\n\t\tfont: {\r\n\t\t\tfontSize: 14,\r\n\t\t\tfontWeight: 'bold'\r\n\t\t},\r\n\t\tvalue:_checked,\r\n\t\tfundNum:_fundNum,\r\n\t\tfundName:_fundName,\r\n\t\tcheckColor:'none'\r\n\t});\r\n\r\n\t/* attach on/off actions */\r\n\tcheckbox.on = function() {\r\n\t\tthis.value = true;\r\n\t\tthis.title='ON';\r\n\t};\r\n\tcheckbox.off = function() {\r\n\t\tthis.value = false;\r\n\t\tthis.title='OFF';\r\n\t};\r\n \r\n\t/* fire action to check or uncheck based on _checked bool param */\r\n\tif (_checked) {\r\n\t\tcheckbox.on();\r\n\t} else {\r\n\t\tcheckbox.off();\r\n\t}\r\n \r\n\tcheckbox.addEventListener('updateCheckBox', function(e) {\r\n\t\talert(e)\r\n\t\t/* can always turn checkboxes off */\r\n\t\tif(e.source.value == true)\r\n\t\t{\r\n\t\t\tcheckbox.off();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcheckbox.on();\r\n\t\t}\r\n\t});\r\n\treturn checkbox;\r\n};\r\n \r\n/*\r\n * Function to create row for fund label\r\n */\r\nfunction createHFGRowLndScpe(_fundBalData) {\r\n\tif( typeof _fundBalData !== 'undefined' && _fundBalData !== null) {\r\n\t\tvar _fundName = _fundBalData.fFundName;\r\n\t\tvar row = Titanium.UI.createTableViewRow({\r\n\t\t\tbackgroundColor : '#FFFFFF',\r\n\t\t\tselectedBackgroundColor : '#FFFFFF',\r\n\t\t\tselectionStyle : 'NONE'\r\n\t\t});\r\n\t\tvar checkBoxView = Ti.UI.createView({\r\n\t\t\tright : 0,\r\n\t\t\theight : 30,\r\n\t\t\twidth : '30%',\r\n\t\t})\r\n\t\trow.addEventListener('click', function(e) {\r\n\t\t\tvar id = e.index;\r\n\t\t\tTi.API.info('Row got click Source: '+e.source+' Row Index:'+e.index);\r\n\t\t\tif( typeof id !== 'undefined' && id !== null) {\r\n\t\t\t\tfundCheckboxArray[id].fireEvent('updateCheckBox');\r\n \t\t}\r\n\t\t});\r\n\t\tvar fundNameLabel = Titanium.UI.createLabel({\r\n\t\t\tleft : '5%',\r\n\t\t\twidth : '65%',\r\n\t\t\ttop : 15,\r\n\t\t\tbottom : 15,\r\n\t\t\theight : 'auto',\r\n\t\t\tcolor : '#363636',\r\n\t\t\ttext : _fundName,\r\n\t\t\tfont : {\r\n\t\t\t\tfontSize : 15,\r\n\t\t\t\tfontFamily : 'Helvetica Neue',\r\n\t\t\t\tfontWeight : 'bold'\r\n\t\t\t},\r\n\t\t});\r\n\t\trow.add(fundNameLabel);\r\n\t\t_fundName = null;\r\n\t\tcheckBoxView.add(_fundBalData.sSwitch);\r\n\t\trow.add(checkBoxView);\r\n\t\treturn row;\r\n\t}\r\n};\r\n{code}\r\n3. Test in 1.7.6, working fine.\r\n4. Now test in 2.1CI, it will fail.\r\n\r\nh4. Extra info\r\n\r\nThe interesting part is \r\n\r\n{code}\r\ncheckbox.addEventListener('updateCheckBox', function(e) {\r\n\t\talert(e)\r\n\t\t/* can always turn checkboxes off */\r\n\t\tif(e.source.value == true)\r\n\t\t{\r\n\t\t\tcheckbox.off();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcheckbox.on();\r\n\t\t}\r\n\t});\r\n{code}", "attachment": [ { "id": "27583", "filename": "alert.png", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-05-08T10:39:36.000+0000", "size": 40692, "mimeType": "image/png" }, { "id": "27584", "filename": "error.png", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-05-08T10:39:36.000+0000", "size": 61925, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Loosing the value of the source in an event", "creator": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": "Titanium SDK version: 2.1.0v20120504\r\nJavascript Engine: V8 \r\nPlatform & version: Android 2.3\r\nDevice Details: Android emulator \r\nHost Operating System: OS X 10.7.3 \r\nTitanium Studio version: 2.0.1", "comment": { "comments": [ { "id": "194121", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "The Alert attachment is the one coming from 1.7.6, working fine. The error one is from 2.1CI.\r\n\r\nBest,\r\n\r\nMauro ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-05-08T10:39:36.000+0000", "updated": "2012-05-08T10:39:36.000+0000" }, { "id": "194283", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Here's a simplified test case:\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow();\r\n \r\nvar view = Ti.UI.createView({\r\n backgroundColor: \"blue\"\r\n});\r\nwin.add(view);\r\n \r\nview.addEventListener(\"myEvent\", function(e) {\r\n e.source.backgroundColor = \"red\";\r\n alert(\"Message: \" + e.message);\r\n});\r\n \r\nview.addEventListener(\"click\", function(e) {\r\n\tvar data = {message: \"Hello!\"};\r\n\te.source.fireEvent(\"myEvent\", data);\r\n\tif (data.hasOwnProperty(\"source\")) {\r\n\t\talert(\"Error: data modified!\");\r\n\t}\r\n});\r\n \r\nwin.open();\r\n{code}\r\n\r\n1. Run application.\r\n2. Color should be blue initially.\r\n3. Click the view.\r\n4. Color should now be red. An alert should appear saying: \"Message: Hello!\".\r\n5. No \"Error\" alerts should appear.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-09T11:58:52.000+0000", "updated": "2012-05-09T14:49:24.000+0000" }, { "id": "194285", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[PR #2159|https://github.com/appcelerator/titanium_mobile/pull/2159] submitted to address issue.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-09T12:06:31.000+0000", "updated": "2012-05-09T12:06:31.000+0000" }, { "id": "194286", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Hello Josh, \r\n\r\ndo you think that will be in for today's or tomorrow's CI?\r\n\r\nBest,\r\n\r\nMauro ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-05-09T12:10:34.000+0000", "updated": "2012-05-09T12:10:34.000+0000" }, { "id": "194287", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Mauro, I would expect tomorrow, but depends on how quickly it can get reviewed.\r\nA possible workaround might be to just use the variable \"checkbox\" directly rather than\r\nusing \"e.source\". Example:\r\n\r\n{code:javascript}\r\ncheckbox.addEventListener(\"updateCheckBox\", function() {\r\n checkbox.value; // <--- you can check value here\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-09T12:15:44.000+0000", "updated": "2012-05-09T12:15:44.000+0000" }, { "id": "195035", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Re-opening to deal with regression on Rhino runtime.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-16T12:46:58.000+0000", "updated": "2012-05-16T12:46:58.000+0000" }, { "id": "195224", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 2.0.2.v20120517141652 on LG Revolution 2.3.6 and Emulator 2.3.3", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-17T16:09:06.000+0000", "updated": "2012-05-17T16:09:06.000+0000" }, { "id": "202615", "author": { "name": "nchhabra", "key": "nchhabra", "displayName": "Neha Chhabra", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Reopening to update labels.", "updateAuthor": { "name": "nchhabra", "key": "nchhabra", "displayName": "Neha Chhabra", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2012-07-11T02:02:00.000+0000", "updated": "2012-07-11T02:02:00.000+0000" }, { "id": "278607", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4887", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-07T05:51:25.000+0000", "updated": "2013-11-07T05:51:25.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }