-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
I want to prevent "moving" (dragging/dropping) a node to a level that already has a specific number of nodes on that level.
For example, at level 0 (top level) I want to restrict it to just 1 node on that level, and for any other levels (children levels) I want to allow them up to 10 nodes on those levels.
Any idea how this could be accomplished?
I thought that with ondragend() function I could "return false;" after getting the "target node level" and then getting the number of nodes on that target node level, but unfortunately ondragend() does not provide any means to know what level you are moving (dragging/dropping) the node to.
For example:
ondragend(node, draggableHelperInfo){
var maxNodesOnFirstLevel = 1;
var maxNodesOnOtherLevels = 10;
// node.afterDropLevel does not exist, but I wish it did!
// nodesOnDropLevel = add code here to find out how many nodes already exist on the target drop level
if (node.afterDropLevel ==0 && nodesOnDropLevel >= maxNodesOnFirstLevel){
return false;
} else if (nodesOnDropLevel >= maxNodesOnOtherLevels){
return false;
}
Metadata
Metadata
Assignees
Labels
No labels