Hello!
How to limit Drag and Drop to only work at level 0 of the tree? The other levels are not possible to carry out the drag and drop.
OK
I have this code implemented in ztreeSettingsCallback.ztreeSettingsCallback.beforeDrop
In which it limits the user to drag and drop to other nodes..
But the way it is implemented I can do the drag and drop. Like for example:
NOK
What I want to do is to limit Drag and Drop only to the root node or level 0.
Thanks!
//insert in ztreeSettingsCallback.ztreeSettingsCallback.beforeDrag "function (treeId, treeNodes) { for (var y=0,l=treeNodes.length; y<l; y++) { var treeNode = treeNodes[y]; var extraOptions = treeNode.extra.split(','); for (i=0;i<extraOptions.length;i++) { var option = extraOptions[i].split(':'); if (option[0] == 'drag') { if (option[1] == 'false') return false; } else if (treeNode.parentTId) { var parentNodeExtraOptions = getParentNode().extra.split(','); for (x=0;x<parentNodeExtraOptions.length;x++) { var poption = parentNodeExtraOptions[x].split(':'); if (poption[0] == 'childDrag') { if (poption[1] == 'false') return false; } } } } } return true; }"