Function(treeId, parentNode, childNodes)setting.async.dataFilter

Overview[ depends on jquery.ztree.core js ]

Function used to pre-process for the return data of Ajax. It is valid when [setting.async.enable = true]

Default: null

Function Parameter Descriptions

treeIdString

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

parentNodeJSON

Parent node's JSON data object

When asynchronously loading the root, the parentNode = null

childNodesArray(JSON) / JSON

Ajax got Array (JSON) / JSON data objects

Return Array(JSON) / JSON

The return value should be the JSON data structure which is supported by the zTree.

v3.x supports to load single node JSON data object.

Examples of setting & function

1. Modify the node name attribute which is ajax got.

function ajaxDataFilter(treeId, parentNode, childNodes) {
    if (childNodes) {
      for(var i =0; i < childNodes.length; i++) {
        childNodes[i].name += "_filter";
      }
    }
    return childNodes;
};
var setting = {
	async: {
		enable: true,
		url: "http://host/getNode.php",
		dataFilter: ajaxDataFilter
	}
};
......