{ "id": "61168", "key": "TIMOB-536", "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": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2011-04-15T02:31:21.000+0000", "created": "2011-04-15T02:31:20.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "1.0", "callback", "custom", "event" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-09T21:20:40.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

Using SDK1.0

\n
\n

This Works:

\n
\nTitanium.App.addEventListener('customEvent', function(e) {\n  Ti.API.debug(\"FIRED!\");\n});\nTitanium.App.fireEvent('customEvent', {foo:'bar'});\n
\n
\n

But, this does not work. Event appears to fire (in console), but\ncallback is never executed:

\n
\nvar tableView = Titanium.UI.createTableView();\nTitanium.UI.currentWindow.add(tableView);\n\nTitanium.App.addEventListener('customEvent', function(e) {\n  Ti.API.debug(\"FIRED!\"); // never executed\n});\nTitanium.App.fireEvent('customEvent', {foo:tableView});\n
\n
\n

This also does not work, but perhaps is not expected to work.\nEvent is never fired:

\n
\nvar tableView = Titanium.UI.createTableView();\nTitanium.UI.currentWindow.add(tableView);\n\ntableView.addEventListener('customEvent', function() {\n  Ti.API.debug(\"FIRED!\"); // never executed\n});\ntableView.fireEvent('customEvent'); // never fires (according to console)\n
{html}", "attachment": [], "flagged": false, "summary": "Firing custom events with data that includes a view causes listener to not listen", "creator": { "name": "noah", "key": "noah", "displayName": "Noah", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "noah", "key": "noah", "displayName": "Noah", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "123495", "author": { "name": "noah", "key": "noah", "displayName": "Noah", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

The documentation does in fact state that the event data must be\nJSON serializeable. That is not true in the second case, which is\nconsistant with the documentation.

\n

The third example however is expected to work based on the\ndocumentation that says it does. See Ticket #581.

{html}", "updateAuthor": { "name": "noah", "key": "noah", "displayName": "Noah", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:20.000+0000", "updated": "2011-04-15T02:31:20.000+0000" }, { "id": "123496", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Maybe I'm missing something, but why should example 3 work?
\nSurely the line

\n
\ntableView.fireEvent('customEvent');\n
\n

should be

\n
\nTi.App.fireEvent('customEvent');\n
\n

put inside a

\n
\ntableView.addEventListener ?\n
{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:21.000+0000", "updated": "2011-04-15T02:31:21.000+0000" }, { "id": "123497", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Noah
\nI take your point that the functionality is indeed in the docs, so\nmy suggestion could be used as an alternative if anyone is having\nissues with implementing example 3. However, I am still not clear\nabout the advantages of example 3. Is it just the tearing down\nthat's mentioned in #581 ?

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:21.000+0000", "updated": "2011-04-15T02:31:21.000+0000" }, { "id": "123498", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

For the reason why example 2 doesn't work, see this \nQ&A

\n

Therefore, I think this ticket is just a duplication of #581. I\npropose that it be closed.

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:21.000+0000", "updated": "2011-04-15T02:31:21.000+0000" }, { "id": "123499", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Dupe of #581.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:21.000+0000", "updated": "2011-04-15T02:31:21.000+0000" }, { "id": "410534", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-09T21:20:40.000+0000", "updated": "2017-03-09T21:20:40.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }