Function(event, treeId, treeNodes, targetNode, moveType, isCopy)setting.callback.onDrop

Overview[ depends on jquery.ztree.exedit js ]

Used to capture the drop event when drag-drop node.

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

Default: null

Function Parameter Descriptions

eventjs event Object

event Object

treeIdString

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

treeNodesArray(JSON)

A collection of the nodes which has been dragged

The treeNodes are the data of the nodes which be dragged, when move nodes.

The treeNodes are the clone data of the nodes which be dragged, when copy 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

If moveType is null, means drag & drop is cancel.

isCopyBoolean

the flag used to judge copy node or move node

true: copy node; false: move node

Examples of setting & function

1. When drag-drop nodes complete, alert the number of dragged nodes and info about targetNode.

function myOnDrop(event, treeId, treeNodes, targetNode, moveType) {
    alert(treeNodes.length + "," + (targetNode ? (targetNode.tId + ", " + targetNode.name) : "isRoot" ));
};
var setting = {
	callback: {
		onDrop: myOnDrop
	}
};
......