JSON / Function(treeId, treeNode)setting.view.nodeClasses

Overview[ depends on jquery.ztree.core js ]

Use className to set text style, only applies to <A> object in the node DOM. (Decoupling CSS from JavaScript)

Default: {add: [], remove: []}

v3.5.43+

JSON Format

add: Array, The className collection to be added. e.g. {add: ['highlight']}

remove: Array, The className collection to be removed. e.g. {remove: ['highlight']}

Function Parameter Descriptions

treeIdString

zTree unique identifier: treeId.

treeNodeJSON

JSON data object of the node which use the personalized text style

Return JSON

Return value is same as 'JSON Format'. e.g. {add: ['highlight'], remove: ['hide']}

Examples of setting & function

1. Set the node name's color to red


		var setting = {
			view: {
				nodeClasses : {add: ['highlight']}
			}
		};

2. Remove the node name's special className: highlight

var setting = {
		view: {
			nodeClasses : {remove: ['highlight']}
		}
	};

3. Set the root node name's color to red

function setNodeClasses(treeId, treeNode) {
	return treeNode.level == 0 ? {add: ['highlight']} : {remove: ['highlight']};
};
var setting = {
	view: {
		nodeClasses: setNodeClasses
	}
};