{"action":"created","issue":{"url":"https://api.github.com/repos/vakata/jstree/issues/1164","labels_url":"https://api.github.com/repos/vakata/jstree/issues/1164/labels{/name}","comments_url":"https://api.github.com/repos/vakata/jstree/issues/1164/comments","events_url":"https://api.github.com/repos/vakata/jstree/issues/1164/events","html_url":"https://github.com/vakata/jstree/issues/1164","id":92108582,"number":1164,"title":"How to use jquery sweetAlert instead of javascripts default confirm when confirming to delete a node","user":{"login":"newton777","id":5426734,"avatar_url":"https://avatars.githubusercontent.com/u/5426734?v=3","gravatar_id":"","url":"https://api.github.com/users/newton777","html_url":"https://github.com/newton777","followers_url":"https://api.github.com/users/newton777/followers","following_url":"https://api.github.com/users/newton777/following{/other_user}","gists_url":"https://api.github.com/users/newton777/gists{/gist_id}","starred_url":"https://api.github.com/users/newton777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/newton777/subscriptions","organizations_url":"https://api.github.com/users/newton777/orgs","repos_url":"https://api.github.com/users/newton777/repos","events_url":"https://api.github.com/users/newton777/events{/privacy}","received_events_url":"https://api.github.com/users/newton777/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-30T14:25:08Z","updated_at":"2015-06-30T15:11:22Z","closed_at":"2015-06-30T15:11:22Z","body":"How to use jquery sweetAlert instead of javascripts default confirm when confirming to delete a node or not? At the moment its just deleting the node and I cant seem to find a way to stop it from deleting the node?\r\n\r\n\"                    'check_callback': function (operation, node, parent, position, more) {\r\n                        if (operation === \"delete_node\")\r\n                        {\r\n                            if (!swal({\r\n                                title: \"Are you sure?\",\r\n                                text: \"This level will be deleted permanantly!\",\r\n                                type: \"warning\",\r\n                                showCancelButton: true,\r\n                                confirmButtonColor: \"#DD6B55\",\r\n                                confirmButtonText: \"Yes, delete it!\",\r\n                                cancelButtonText: \"No, cancel!\",\r\n                                closeOnConfirm: false,\r\n                                closeOnCancel: false\r\n                            },\r\n                            function (isConfirm) {\r\n                                   if (isConfirm) {\r\n                                   deleteLevel();\r\n                                   return true;\r\n\r\n                            } else {\r\n                                   swal(\"Cancelled\", \"Level is safe :)\", \"error\");\r\n                                   return false;\r\n                            }\r\n                            })) {\r\n                                //e.stopImmediatePropagation();\r\n                                return false;\r\n                            }\r\n\r\n                        }\r\n                    }\""},"comment":{"url":"https://api.github.com/repos/vakata/jstree/issues/comments/117221736","html_url":"https://github.com/vakata/jstree/issues/1164#issuecomment-117221736","issue_url":"https://api.github.com/repos/vakata/jstree/issues/1164","id":117221736,"user":{"login":"vakata","id":146052,"avatar_url":"https://avatars.githubusercontent.com/u/146052?v=3","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":"2015-06-30T15:11:22Z","updated_at":"2015-06-30T15:11:22Z","body":"You cannot - `check_callback` does not work with async responses - you have to prevent the action right away. My guess is you need to attach your dialog when the user clicks delete (in your interface), and only if the user confirms - to actually delete the node. \r\n\r\nIf you are using the contextmenu plugin and want to capture its delete action too - override it - let me know if you need any pointers on how to do that.\r\n\r\nBest regards,\r\nIvan"}}