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

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

Used to capture the event before drag-drop node, zTree based on return value to determine whether to allow drag-drop node.

Default: null

When drop the nodes, if the dragged nodes is not in a valid location, this callback will not triggered, and will restore the original position.

### Function Parameter Descriptions

#### treeIdString

zTree unique identifier: treeId, the tree is what the targetNode is belong to, easy for users to control.

#### treeNodesArray(JSON)

A collection of the nodes which has been dragged

The treeNodes are the data of the nodes which has been dragged, when copy nodes or move nodes.

#### targetNodeJSON

JSON data object of the target node which treeNodes are drag-dropped.

If the treeNodes will be 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 judge copy node or move 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 zTreeBeforeDrop(treeId, treeNodes, targetNode, moveType) {
        return !(targetNode == null || (moveType != "inner" && !targetNode.parentTId));
    };
    var setting = {
    	edit: {
    		enable: true
    	},
    	callback: {
    		beforeDrop: zTreeBeforeDrop
    	}
    };
    ......