日期:2014-05-16 浏览次数:20380 次
$(function() {
var setting = {
async : {
enable : true,
url : templateRoot + '/tree/treeAction_tree.do',
autoParam : [ "nodeId" ]
},
data : {
simpleData : {
enable : true,
idKey : "nodeId",
pIdKey : "parentNodeId",
rootPId : "root"
}
}
};
$.fn.zTree.init($("#tree"), setting);
});
[{"nodeId":"root","parentNodeId":null,"nodeName":"组织名称"}]
async: {
dataFilter: ajaxDataFilter
}
//对返回的数据进行过滤
function ajaxDataFilter(treeId, parentNode, childNodes) {
if (childNodes) {
for(var i =0; i < childNodes.length; i++) {
childNodes[i].name += "_filter";
}
}
return childNodes;
};