Function(treeId, treeNodes)setting.callback.beforeDrag

Overview[ depends on jquery.ztree.exedit js ]

Specify callback function to be called before the drag node callback, The return value controls whether the drag node callback will execute.

Default: null

Function Parameter Descriptions

treeIdString

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

treeNodesArray(JSON)

A collection of the nodes being dragged

v3.x allows the drag and drop of multiple sibling nodes, so this parameter's type is changed to Array(JSON).

If the selected nodes aren't sibling nodes, you can only drag one node.

Return Boolean

return true or false

If return false, zTree will abort the drag and drop, and will not trigger the 'onDrag / beforeDrop / onDrop' sequence of callbacks.

Examples of setting & function

1. disable drag completely (by returning false)

function myBeforeDrag(treeId, treeNodes) {
    return false;
};
var setting = {
	edit: {
		enable: true
	},
	callback: {
		beforeDrag: myBeforeDrag
	}
};
......