Function(event, treeId, treeNodes, targetNode, moveType)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, easy for users to control.

treeNodesArray(JSON)

A collection of the nodes which has been dragged

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

Examples of setting & function

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

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