{"action":"created","issue":{"url":"https://api.github.com/repos/DavidDurman/joint/issues/128","labels_url":"https://api.github.com/repos/DavidDurman/joint/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/DavidDurman/joint/issues/128/comments","events_url":"https://api.github.com/repos/DavidDurman/joint/issues/128/events","html_url":"https://github.com/DavidDurman/joint/issues/128","id":68020696,"number":128,"title":"using jointJS inside a module","user":{"login":"mteichtahl","id":1817657,"avatar_url":"https://avatars.githubusercontent.com/u/1817657?v=3","gravatar_id":"","url":"https://api.github.com/users/mteichtahl","html_url":"https://github.com/mteichtahl","followers_url":"https://api.github.com/users/mteichtahl/followers","following_url":"https://api.github.com/users/mteichtahl/following{/other_user}","gists_url":"https://api.github.com/users/mteichtahl/gists{/gist_id}","starred_url":"https://api.github.com/users/mteichtahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mteichtahl/subscriptions","organizations_url":"https://api.github.com/users/mteichtahl/orgs","repos_url":"https://api.github.com/users/mteichtahl/repos","events_url":"https://api.github.com/users/mteichtahl/events{/privacy}","received_events_url":"https://api.github.com/users/mteichtahl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-13T06:45:01Z","updated_at":"2015-04-14T12:38:49Z","closed_at":null,"body":"I am currently refactoring my jointJS code out of the main js code and into a module\r\n\r\nI an exporting the following (with paper and graph module variables)\r\n\r\n\"create\": function (graphTarget,options) {\r\n    target = $(window.document.getElementById(graphTarget));\r\n\r\n    if (graph === undefined)\r\n      graph = new joint.dia.Graph();\r\n\r\n    var defaultPaperOptions = {\r\n      el: target,\r\n      width: target.width(),\r\n      graph: graph,\r\n      interactive: true,\r\n      gridSize: 1\r\n    };\r\n    options = _.extend(defaultPaperOptions, options);\r\n    paper = new joint.dia.Paper(options);\r\n    return this;\r\n  }\r\n\r\nHowever, I get the following JS errors - ore.js?v=1428907215:61030 Uncaught TypeError: Cannot read property '_listenId' of undefined'\r\n\r\nThis is occuring when new joint.dia.Paper(options) is being called\r\n\r\nI have checked target which is\r\n\r\n[div#schemaChart.text-center.ibox-content, context: div#schemaChart.text-center.ibox-content, jquery: \"2.1.3\", constructor: function, selector: \"\", toArray: function…]\r\n0: div#schemaChart.text-center.ibox-content\r\ncontext: div#schemaChart.text-center.ibox-content\r\nlength: 1\r\n__proto__: jQuery[0]\r\n\r\nAny guidance would be appreciated\r\n"},"comment":{"url":"https://api.github.com/repos/DavidDurman/joint/issues/comments/92796781","html_url":"https://github.com/DavidDurman/joint/issues/128#issuecomment-92796781","issue_url":"https://api.github.com/repos/DavidDurman/joint/issues/128","id":92796781,"user":{"login":"kumilingus","id":3967880,"avatar_url":"https://avatars.githubusercontent.com/u/3967880?v=3","gravatar_id":"","url":"https://api.github.com/users/kumilingus","html_url":"https://github.com/kumilingus","followers_url":"https://api.github.com/users/kumilingus/followers","following_url":"https://api.github.com/users/kumilingus/following{/other_user}","gists_url":"https://api.github.com/users/kumilingus/gists{/gist_id}","starred_url":"https://api.github.com/users/kumilingus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumilingus/subscriptions","organizations_url":"https://api.github.com/users/kumilingus/orgs","repos_url":"https://api.github.com/users/kumilingus/repos","events_url":"https://api.github.com/users/kumilingus/events{/privacy}","received_events_url":"https://api.github.com/users/kumilingus/received_events","type":"User","site_admin":false},"created_at":"2015-04-14T12:38:49Z","updated_at":"2015-04-14T12:38:49Z","body":"I mean a working example of the app (html + js) that I can run in browser\nand see where it fails. Cheers.\n\nOn 14 April 2015 at 14:13, Marc Teichtahl <notifications@github.com> wrote:\n\n> Romance\n> A copy of the adjacency list?\n>\n>\n>\n>\n>\n>\n> On Tue, Apr 14, 2015 at 3:44 AM -0700, \"Roman Bruckner\" <\n> notifications@github.com> wrote:\n>\n>\n>\n>\n>\n>\n>\n>\n>\n>\n> Hi Mark,\n>\n>\n>\n> this error can occur when a link points (via source or target) to an\n>\n> element which is not part of the graph (or there is no view rendered on the\n>\n> paper for this element).\n>\n> You saying the code works fine when is transposed out of the module, so I\n>\n> expect the error is not related to an inconsistent adjacency list.\n>\n>\n>\n> Could you send me an example that I can run and debug?\n>\n>\n>\n> Cheers,\n>\n> Roman\n>\n>\n>\n> On 13 April 2015 at 23:53, Marc Teichtahl <notifications@github.com>\n> wrote:\n>\n>\n>\n> > Any advice would be helpful\n>\n> >\n>\n> > —\n>\n> > Reply to this email directly or view it on GitHub\n>\n> > <https://github.com/DavidDurman/joint/issues/128#issuecomment-92511542>.\n>\n> >\n>\n>\n>\n>\n>\n>\n>\n> --\n>\n> Roman Brückner\n>\n> CTO at client.io\n>\n> +420 776 504 406\n>\n> roman@client.io\n>\n>\n>\n>\n>\n> —\n> Reply to this email directly or view it on GitHub.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/DavidDurman/joint/issues/128#issuecomment-92786478>.\n>\n\n\n\n-- \nRoman Brückner\nCTO at client.io\n+420 776 504 406\nroman@client.io\n"}}