{"action":"created","issue":{"url":"https://api.github.com/repos/vakata/jstree/issues/2061","repository_url":"https://api.github.com/repos/vakata/jstree","labels_url":"https://api.github.com/repos/vakata/jstree/issues/2061/labels{/name}","comments_url":"https://api.github.com/repos/vakata/jstree/issues/2061/comments","events_url":"https://api.github.com/repos/vakata/jstree/issues/2061/events","html_url":"https://github.com/vakata/jstree/issues/2061","id":346815010,"node_id":"MDU6SXNzdWUzNDY4MTUwMTA=","number":2061,"title":"Children loaded twice through ajax cause tree to stop working","user":{"login":"ThorsteinnHelgi","id":34395062,"node_id":"MDQ6VXNlcjM0Mzk1MDYy","avatar_url":"https://avatars3.githubusercontent.com/u/34395062?v=4","gravatar_id":"","url":"https://api.github.com/users/ThorsteinnHelgi","html_url":"https://github.com/ThorsteinnHelgi","followers_url":"https://api.github.com/users/ThorsteinnHelgi/followers","following_url":"https://api.github.com/users/ThorsteinnHelgi/following{/other_user}","gists_url":"https://api.github.com/users/ThorsteinnHelgi/gists{/gist_id}","starred_url":"https://api.github.com/users/ThorsteinnHelgi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThorsteinnHelgi/subscriptions","organizations_url":"https://api.github.com/users/ThorsteinnHelgi/orgs","repos_url":"https://api.github.com/users/ThorsteinnHelgi/repos","events_url":"https://api.github.com/users/ThorsteinnHelgi/events{/privacy}","received_events_url":"https://api.github.com/users/ThorsteinnHelgi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-02T00:20:09Z","updated_at":"2018-08-02T18:44:43Z","closed_at":"2018-08-02T07:07:05Z","author_association":"NONE","body":"I have a tree with 5 parents that together hold 8 children. I load the tree using ajax from two json files. All loads fine and displays fine.\r\n\r\nI can expand a parent node and collapse it multiple times. \r\n\r\nHowever if I expand another parent node I notice that the children of all the other parent notes are doubled in \"this._model.data\" (debugging in Chrome.) \"this._model.data\" was fine prior to this and the newly expanded node is also fine. When I then try to expand some of the other nodes (e.g. the first node that used to work fine) an exception is eventually thrown in \"redraw_node\" function (line 1433: \"b.setAttribute(\"aria-level\", f.parents.length),\") and the tree stops working (not able to expand parent nodes any more).\r\n\r\nError shown:  \"Uncaught TypeError: Cannot read property 'length' of undefined\"\r\n\r\nHowever the error seems to be triggered by the double loading of the children into \"this._model.data\" when I expanded the second parent node."},"comment":{"url":"https://api.github.com/repos/vakata/jstree/issues/comments/410028710","html_url":"https://github.com/vakata/jstree/issues/2061#issuecomment-410028710","issue_url":"https://api.github.com/repos/vakata/jstree/issues/2061","id":410028710,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDAyODcxMA==","user":{"login":"ThorsteinnHelgi","id":34395062,"node_id":"MDQ6VXNlcjM0Mzk1MDYy","avatar_url":"https://avatars3.githubusercontent.com/u/34395062?v=4","gravatar_id":"","url":"https://api.github.com/users/ThorsteinnHelgi","html_url":"https://github.com/ThorsteinnHelgi","followers_url":"https://api.github.com/users/ThorsteinnHelgi/followers","following_url":"https://api.github.com/users/ThorsteinnHelgi/following{/other_user}","gists_url":"https://api.github.com/users/ThorsteinnHelgi/gists{/gist_id}","starred_url":"https://api.github.com/users/ThorsteinnHelgi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThorsteinnHelgi/subscriptions","organizations_url":"https://api.github.com/users/ThorsteinnHelgi/orgs","repos_url":"https://api.github.com/users/ThorsteinnHelgi/repos","events_url":"https://api.github.com/users/ThorsteinnHelgi/events{/privacy}","received_events_url":"https://api.github.com/users/ThorsteinnHelgi/received_events","type":"User","site_admin":false},"created_at":"2018-08-02T18:44:43Z","updated_at":"2018-08-02T18:44:43Z","author_association":"NONE","body":"Root json: data/a4s.json\r\n[\r\n    { \"id\" : \"A\", \"parent\" : \"#\", \"text\" : \"A\", \"state\" : { \"opened\" : false}, \"children\" : true, \"a_attr\" : { \"path\" : \"\"} },\r\n    { \"id\" : \"B\", \"parent\" : \"#\", \"text\" : \"B\", \"state\" : { \"opened\" : false}, \"children\" : true, \"a_attr\" : { \"path\" : \"\"} }\r\n]\r\n\r\nChildren json: data/a4s_ch.json\r\n[\r\n    { \"id\" : \"L11\", \"parent\" : \"A\", \"text\" : \"L11\", \"children\" : false, \"a_attr\" : { \"path\" : \"\"} },\r\n    { \"id\" : \"L12\", \"parent\" : \"A\", \"text\" : \"L12\", \"children\" : false, \"a_attr\" : { \"path\" : \"\"} },\r\n    { \"id\" : \"L13\", \"parent\" : \"A\", \"text\" : \"L13\", \"children\" : false, \"a_attr\" : { \"path\" : \"\"} },\r\n    { \"id\" : \"L31\", \"parent\" : \"B\", \"text\" : \"L31\", \"children\" : false, \"a_attr\" : { \"path\" : \"\"} },\r\n    { \"id\" : \"L32\", \"parent\" : \"B\", \"text\" : \"L32\", \"children\" : false, \"a_attr\" : { \"path\" : \"\"} },\r\n    { \"id\" : \"L33\", \"parent\" : \"B\", \"text\" : \"L33\", \"children\" : false, \"a_attr\" : { \"path\" : \"\"} }\r\n ]\r\n\r\nLoading data:\r\n                'data' : {\r\n                    'dataType': 'json',\r\n                    'contentType':'application/json; charset=utf-8',\r\n                    url : function (node) { \r\n                        var theUrl = node.id === '#' ?\r\n                            'data/a4s.json' : \r\n                            'data/a4s_ch.json';                        \r\n                        console.log(\"theUrl: \" + theUrl);\r\n                        return theUrl;\r\n                    },\r\n                    data : function (node) { \r\n                        let nodeObj = {\"id\":node.id, \"text\":\"\", \"path\":\"\"};\r\n                        if (node.id !== '#') {\r\n                            nodeObj.text = node.text;\r\n                            nodeObj.path = node.a_attr.path;\r\n                        }\r\n                        console.log(\"Node.id: \" + node.id + \", text: \" + nodeObj.text + \", path: \" + nodeObj.path);\r\n                        return nodeObj; \r\n                    }\r\n                }\r\n\r\n![image](https://user-images.githubusercontent.com/34395062/43603951-01197872-9684-11e8-98dc-4b6b8161946d.png)\r\n\r\nError: \r\nExpand A\r\nCollaps A\r\nExpand B (see picture)\r\nNow I can not expand A"}}
{"actor":{"display_login":"ThorsteinnHelgi"}}