the question is simple but I didn't found any similar to this. I'd like to enable fancytree with dnd plugin, but each node should maintain his own parent (if it's root he should remain root).
Thanks, Riccardo
the question is simple but I didn't found any similar to this. I'd like to enable fancytree with dnd plugin, but each node should maintain his own parent (if it's root he should remain root).
Thanks, Riccardo
This is the solution I was looking for:
extensions: ["dnd"],
dnd: {
autoExpandMS: 400,
focusOnClick: true,
preventVoidMoves: true, // Prevent dropping nodes 'before self', etc.
preventRecursiveMoves: true, // Prevent dropping nodes on own descendants
dragStart: function(node, data) {
// if false dnd is disabled
return true;
},
dragStop: function(node, data) {
return true;
},
dragEnter: function(node, data) {
if(node.parent !== data.otherNode.parent) return false;
return true;
},
dragDrop: function(node, data) {
// if dropped to another node insert it before!
data.otherNode.moveTo(node, "before");
}