{"action":"created","issue":{"url":"https://api.github.com/repos/vakata/jstree/issues/2136","repository_url":"https://api.github.com/repos/vakata/jstree","labels_url":"https://api.github.com/repos/vakata/jstree/issues/2136/labels{/name}","comments_url":"https://api.github.com/repos/vakata/jstree/issues/2136/comments","events_url":"https://api.github.com/repos/vakata/jstree/issues/2136/events","html_url":"https://github.com/vakata/jstree/issues/2136","id":370623926,"node_id":"MDU6SXNzdWUzNzA2MjM5MjY=","number":2136,"title":"When move node, i want destination node id/ref to update its position into database","user":{"login":"ravi-ku","id":11146609,"node_id":"MDQ6VXNlcjExMTQ2NjA5","avatar_url":"https://avatars1.githubusercontent.com/u/11146609?v=4","gravatar_id":"","url":"https://api.github.com/users/ravi-ku","html_url":"https://github.com/ravi-ku","followers_url":"https://api.github.com/users/ravi-ku/followers","following_url":"https://api.github.com/users/ravi-ku/following{/other_user}","gists_url":"https://api.github.com/users/ravi-ku/gists{/gist_id}","starred_url":"https://api.github.com/users/ravi-ku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravi-ku/subscriptions","organizations_url":"https://api.github.com/users/ravi-ku/orgs","repos_url":"https://api.github.com/users/ravi-ku/repos","events_url":"https://api.github.com/users/ravi-ku/events{/privacy}","received_events_url":"https://api.github.com/users/ravi-ku/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-10-16T13:53:14Z","updated_at":"2018-10-17T12:19:52Z","closed_at":"2018-10-16T19:27:58Z","author_association":"NONE","body":"Hi,\r\n\r\nWhen moving node, i want source & destination nodes info to update info into database. Although, i found source node info. But i also need destination node info to update in the database. Please help.\r\n\r\n**Below is my code:**\r\n\r\n.on('move_node.jstree', function (e, data) {\r\n                    //debugger;\r\n                    $.get('@Url.Action(\"MoveNode\", \"ProjectSettings\")',\r\n                        {\r\n                            'operation'     : 'move_node',\r\n                            'projectId'     : @ViewBag.ProjectID,\r\n                            'id' \t\t    : data.node.id,\r\n                            'parent' \t\t: data.parent,\r\n                            'oldparent'     : data.old_parent,\r\n                            'position' \t    : data.position,\r\n                            'oldPosition'   : data.old_position\r\n\r\n                        })\r\n                        .fail(function () {\r\n                            data.instance.refresh();\r\n                        });\r\n                    console.log('===== Moving '+ data.node.text + '========' );\r\n                    console.log('id          =', data.node.id );\r\n                    console.log('parent      =', data.parent);\r\n                    console.log('position    =', data.position );\r\n                    console.log('old_position=', data.old_position );\r\n                    console.log('old_parent  =', data.old_parent );\r\n\r\n                });"},"comment":{"url":"https://api.github.com/repos/vakata/jstree/issues/comments/430605789","html_url":"https://github.com/vakata/jstree/issues/2136#issuecomment-430605789","issue_url":"https://api.github.com/repos/vakata/jstree/issues/2136","id":430605789,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDYwNTc4OQ==","user":{"login":"vakata","id":146052,"node_id":"MDQ6VXNlcjE0NjA1Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/146052?v=4","gravatar_id":"","url":"https://api.github.com/users/vakata","html_url":"https://github.com/vakata","followers_url":"https://api.github.com/users/vakata/followers","following_url":"https://api.github.com/users/vakata/following{/other_user}","gists_url":"https://api.github.com/users/vakata/gists{/gist_id}","starred_url":"https://api.github.com/users/vakata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vakata/subscriptions","organizations_url":"https://api.github.com/users/vakata/orgs","repos_url":"https://api.github.com/users/vakata/repos","events_url":"https://api.github.com/users/vakata/events{/privacy}","received_events_url":"https://api.github.com/users/vakata/received_events","type":"User","site_admin":false},"created_at":"2018-10-17T12:19:52Z","updated_at":"2018-10-17T12:19:52Z","author_association":"OWNER","body":"```move_node``` moves a node to a new position, by design it does not replace a node (read below on why I clarify this). \r\n\r\nFor example:\r\n```\r\nRoot1\r\nRoot2\r\n  Child1\r\n  Child2\r\n```\r\nIf you grab Root1 and drop it between Child1 and Child2, that wound mean that inside the ```move_node``` event you will get data.node which is Root1, position which is 1 and parent - which is Root2. \r\nGiven the functions you already know - if you need to get the node currently occupying that place (if any) you can use:\r\n```\r\ncurrentID = data.instance.get_node(data.parent).children[data.position]; \r\n```\r\nIf you need the whole node:\r\n```\r\ndata.instance.get_node(currentID);\r\n```\r\n**Keep in mind if I drop Root1 AFTER Child2, it will occupy position number 2, which is currently empty (it won't replace anything).**"}}
{"actor":{"display_login":"vakata"}}