Function(treeNode, checkTypeFlag)zTreeObj.updateNode

Overview[ depends on jquery.ztree.core js ]

Update node data. Primarily used to update the node's DOM.

1. Can update the attributes for display (e.g. 'name', 'target', 'url', 'icon', 'iconSkin', 'checked'), do not update the other attributes. For example: If you need to expand the node, please use expandNode() method, do not modify the 'open' attribute.

2. Use updateNode() method of zTree can't trigger 'beforeCheck' or 'onCheck' callback function.

Please use zTree object to executing the method.

Function Parameter Descriptions

treeNodeJSON

JSON data object of the node which need to update.

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

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.

This parameter is valid when 'setting.check.enable = true' and 'setting.check.chkStyle = "checkbox"'

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

Return none

no return value

Examples of function

1. Modify the first selected node's name, and update it.

var treeObj = $.fn.zTree.getZTreeObj("tree");
var nodes = treeObj.getNodes();
if (nodes.length>0) {
	nodes[0].name = "test";
	treeObj.updateNode(nodes[0]);
}