ztree实现复选框单选功能
/** * 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); } } }