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

Overview[ depends on jquery.ztree.core js ]

Callback function to pre-process Ajax return data. It is valid when [setting.async.enable = true]

Default: null

Function Parameter Descriptions

treeIdString

zTree unique identifier: treeId

parentNodeJSON

Parent node's JSON data object

When asynchronously loading the root, the parentNode = null

responseDataArray(JSON) / JSON / String

Array (JSON) / JSON / String data objects

From v3.4, support XML strings.

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 attributes returned by an Ajax request.

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