var setting = {
check: {
enable: true
},
data: {
simpleData: {
enable: true
}
},
callback:{ //第一步
onClick:zTreeOnClick
}
};
function zTreeOnClick(event, treeId, treeNode) { //第二步
var treeObj = $.fn.zTree.getZTreeObj("treeDemo"),
nodes = treeObj.getCheckedNodes(true),
v = "";
for (var i = 0; i < nodes.length; i++) {
v += nodes[i].name + ",";
console.log("节点id:" + nodes[i].id + "节点名称" + v); //获取选中节点的值
}
}
很简单,分两步即可实现,详见代码!