## Function(treeId, treeNodes, targetNode, moveType, isCopy)setting.callback.beforeDrop

### Overview[ depends on jquery.ztree.exedit js ]

Specify callback function to be called before drag-drop of a node, The return value controls the execution of drag-drop callback.

Default: null

When a node is dropped, if the drop is not in a valid location, this callback will not be triggered, and will revert to the original position.

### Function Parameter Descriptions

#### treeIdString

zTree unique identifier: treeId, the id of the containing tree.

#### treeNodesArray(JSON)

A collection of the nodes which has been dragged

The treeNodes which have been dragged, when copying nodes or moving nodes.

#### targetNodeJSON

JSON data object of the destination node on which treeNodes are being dropped.

If the treeNodes is the root node, the targetNode = null

#### moveTypeString

the relative position of move to the target node

"inner": will be child of targetNode

"prev": will be sibling node, and be in front of targetNode

"next": will be sibling node, and be behind targetNode

#### isCopyBoolean

the flag used to determine if the drop is to copy or move the node

true: copy node; false: move node

#### Return Boolean

return true or false

If return false, zTree will restore the dragged nodes, and will not trigger the 'onDrop' callback.

### Examples of setting & function

#### 1. disable to drag nodes to root

    function myBeforeDrop(treeId, treeNodes, targetNode, moveType) {
        return !(targetNode == null || (moveType != "inner" && !targetNode.parentTId));
    };
    var setting = {
    	edit: {
    		enable: true
    	},
    	callback: {
    		beforeDrop: myBeforeDrop
    	}
    };
    ......