Function(treeNode, checked, checkTypeFlag, callbackFlag)zTreeObj.checkNode

Overview[ depends on jquery.ztree.excheck js ]

Check or unCheck a single node. It is valid when [setting.check.enable = true]

Use checkNode() method of zTree v3.x can trigger 'beforeCheck' or 'onCheck' callback function. for reduce redundant code.

Please use zTree object to executing the method.

Function Parameter Descriptions

treeNodeJSON

JSON data object of the node which need to be checked or unchecked.

Please ensure that this data object is an internal node data object in zTree.

checkedBoolean

checked = true means: check node.

checked = false means: uncheck node.

If this parameter is omitted, then toggle check or uncheck depend this node's expanded state.

Don't affect the node which 'nochecked' attribute is true.

checkTypeFlagBoolean

checkTypeFlag = true means: According to 'setting.check.chkboxType' attribute automatically check or uncheck the parent and child nodes.

checkTypeFlag = false means: only check or uncheck this node, don't affect its parent and child nodes.

When checkTypeFlag = false and treeNode.checked = checked, will not trigger callback function.

Don't affect the parent and child nodes which 'nochecked' attribute is true.

callbackFlagBoolean

callbackFlag = true means: call this method, will trigger 'beforeCheck' & 'onCheck' callback.

callbackFlag = false means: call this method, will not trigger callback.

If this parameter is omitted, it is same as 'callbackFlag = false'

Return none

no return value

Examples of function

1. check the selected nodes

var treeObj = $.fn.zTree.getZTreeObj("tree");
var nodes = treeObj.getSelectedNodes();
for (var i=0, l=nodes.length; i < l; i++) {
	treeObj.checkNode(nodes[i], true, true);
}