Function(treeId, treeNode)setting.view.addDiyDom

Overview[ depends on jquery.ztree.core js ]

This function used to display the custom control on the node.

1. If you have huge node data, please note: this function will affect the initialization performance. If not required, it is recommended not to use this function.

2. This function is an advanced application, please make sure that a better understanding of zTree before you use it.

Default: null

Function Parameter Descriptions

treeIdString

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

treeNodeJSON

JSON data object of the node which display the custom control.

Examples of setting & function

1. Display button in all nodes.

var setting = {
	view: {
		addDiyDom: addDiyDom
	}
};
function addDiyDom(treeId, treeNode) {
	var aObj = $("#" + treeNode.tId + "_a");
	if ($("#diyBtn_"+treeNode.id).length>0) return;
	var editStr = "<span id='diyBtn_space_" +treeNode.id+ "' > </span>"
		+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
		+ "' title='"+treeNode.name+"' onfocus='this.blur();'></button>";
	aObj.append(editStr);
	var btn = $("#diyBtn_"+treeNode.id);
	if (btn) btn.bind("click", function(){alert("diy Button for " + treeNode.name);});
};
......