jsTree drag and drop with ajax

212 views
Skip to first unread message

Ignace Mella

unread,
Mar 24, 2020, 10:43:39 AM3/24/20
to jsTree
Hello, the problem with my code is that the node changes in the database but it doesn''t change from place. So the original idea of dnd doesn't work. 
When I replace an item, the ajax command runs, but it doesn't replace on the page.
What is the problem and what can I do?

AS.Http.post({
action: "getTools"
}, function (res) {
$('#tool-tree').jstree({
'plugins': ["wholerow", "dnd"],
'core' : {
'data' : res,
check_callback: function (op, node, parent, position, more) {
if (op === "move_node" && more && more.core) {
var result = false;

$('#tool-tree').parent().addClass("dimmed");

AS.Http.post({
action: "updateTool",
toolId: node.id,
parentId: parent.id != "#" ? parent.id : null
}, function () {
result = true;
$('#tool-tree').parent().removeClass("dimmed");
});

return result;
}
},
'themes': {
'name': 'proton',
'icons' : false,
'responsive': true
}
},
dnd: {
inside_pos: "last"
}
});
});
Reply all
Reply to author
Forward
0 new messages