Function(treeId, treeNode, newName)setting.callback.beforeRename

Overview[ depends on jquery.ztree.exedit js ]

Used to capture the event before rename(when input DOM blur or press Enter Key), zTree based on return value to determine whether to allow to rename node.

When node is editing name, press the ESC key to restore the original name and stop edit name.

Default: null

Function Parameter Descriptions

treeIdString

zTree unique identifier: treeId, easy for users to control.

treeNodeJSON

JSON data object of the node which will be rename.

newNameString

the new name

Return Boolean

return true or false

If return false, the treeNode will keep the editing name, don't trigger the 'onRename' callback, and will ignore other enents, until the callback return true.

If returns false, zTree will not set the input box to get focus to avoid the warning message which led to repeated triggering ‘beforeRename’ callback. Please use editName() method to set the input box to get focus when user close the warning message.

Examples of setting & function

1. the length of the new name can't less than 5

function zTreeBeforeRename(treeId, treeNode, newName) {
	return newName.length > 5;
}
var setting = {
	edit: {
		enable: true
	},
	callback: {
		beforeRename: zTreeBeforeRename
	}
};
......