/** * ztree的默認配置項 * */ var setting = { view: { selectedMulti: false //按住ctrl是否可以多選 }, check: { enable: true , chkStyle: 'checkbox' }, data: { simpleData: { enable: true } }, async: { enable: true ,type:"post" ,url:test.ztreeDftUrl ,dataFilter:function (treeId, parNode, jsonData) { return test.replaceIcon(treeId, jsonData); } ,otherParam:null }, callback: { //禁止節點被選中 beforeClick:function () { //禁止節點被選中 var e = e ||window.event; e.stopPropagation(); return false; }, onCheck:function (e, treeId, treeNode) { var treeObj = $.fn.zTree.getZTreeObj(treeId); var status = treeNode. checked; treeObj.checkAllNodes(false); treeObj.checkNode(treeNode, status, false); } } }