javascript - Error context menu with jsTree -
i wanna know why when try open context menu first time good, when try use second time doesn't work, mean can use 1st time because 2nd time console sends me error:
jquery-2.2.4.min.js?_=1501245597074:4 xhr finished loading: post "http://localhost:8080/survey/json/getcategoryjson.jsp". send @ jquery-2.2.4.min.js?_=1501245597074:4 ajax @ jquery-2.2.4.min.js?_=1501245597074:4 (anonymous) @ test.jsp:83 dispatch @ jquery-2.2.4.min.js:3 r.handle @ jquery-2.2.4.min.js:3 trigger @ jquery-2.2.4.min.js:4 triggerhandler @ jquery-2.2.4.min.js:4 trigger @ jstree.min.js:2 select_node @ jstree.min.js:3 activate_node @ jstree.min.js:3 show_contextmenu @ jstree.min.js:4 (anonymous) @ jstree.min.js:4 f @ jquery-2.2.4.min.js:2 dispatch @ jquery-2.2.4.min.js:3 r.handle @ jquery-2.2.4.min.js:3"
my jstree code this:
$.ajax({ async: true, type: "post", url: "json/folderjsonname.jsp", datatype: "json", success: function (data) { $.jstree.defaults.core.check_callback = true; $.jstree.defaults.plugins = ["contextmenu"]; $('#jstree').jstree({ core: { data: data, }, plugins: ["contextmenu"], "contextmenu": { "items": function ($node) { var tree = $("#jstree").jstree(true); return { "create": { "separator_before": false, "separator_after": false, "label": "create", "action": function (obj) { $node = tree.create_node($node); tree.edit($node); } }, "rename": { "separator_before": false, "separator_after": false, "label": "rename", "action": function (obj) { tree.edit($node); } }, "remove": { "separator_before": false, "separator_after": false, "label": "remove", "action": function (obj) { tree.delete_node($node); } } }; } }, }); }, error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); alert(thrownerror); } });
Comments
Post a Comment