Function(treeId, parentNode, responseData)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

responseDataArray(JSON) / JSON / String

Ajax got Array (JSON) / JSON / String data objects

From v3.4, support the string with XML format.

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, 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
	}
};
......