标签:
zTree删除节点.
1 <!DOCTYPE html> 2 <HTML> 3 <HEAD> 4 <TITLE> ZTREE DEMO - edit</TITLE> 5 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 6 <link rel="stylesheet" href="../../../css/demo.css" type="text/css"> 7 <link rel="stylesheet" href="../../../css/zTreeStyle/zTreeStyle.css" type="text/css"> 8 <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script> 9 <script type="text/javascript" src="../../../js/jquery.ztree.core-3.5.js"></script> 10 <script type="text/javascript" src="../../../js/jquery.ztree.excheck-3.5.js"></script> 11 <script type="text/javascript" src="../../../js/jquery.ztree.exedit-3.5.js"></script> 12 <SCRIPT type="text/javascript"> 13 var setting = { 14 edit: { 15 enable: true, 16 showRemoveBtn: function(treeId, treeNode) { 17 if(treeNode.level == 0) { 18 return false; 19 } else { 20 return true; 21 } 22 }, 23 showRenameBtn: false, 24 removeTitle: "删除" 25 }, 26 data: { 27 simpleData: { 28 enable: true 29 } 30 }, 31 callback: { 32 beforeDrag: beforeDrag 33 } 34 }; 35 36 var zNodes =[ 37 { id:1, pId:0, name:"父节点 1", open:true}, 38 { id:11, pId:1, name:"叶子节点 1-1"}, 39 { id:12, pId:1, name:"叶子节点 1-2"}, 40 { id:13, pId:1, name:"叶子节点 1-3"}, 41 { id:2, pId:0, name:"父节点 2", open:true}, 42 { id:21, pId:2, name:"叶子节点 2-1"}, 43 { id:22, pId:2, name:"叶子节点 2-2"}, 44 { id:23, pId:2, name:"叶子节点 2-3"}, 45 { id:3, pId:0, name:"父节点 3", open:true}, 46 { id:31, pId:3, name:"叶子节点 3-1"}, 47 { id:32, pId:3, name:"叶子节点 3-2"}, 48 { id:33, pId:3, name:"叶子节点 3-3"} 49 ]; 50 51 function beforeDrag(treeId, treeNodes) { 52 return false; 53 } 54 $(document).ready(function(){ 55 $.fn.zTree.init($("#treeDemo"), setting, zNodes); 56 }); 57 </SCRIPT> 58 </HEAD> 59 60 <BODY> 61 <div class="content_wrap"> 62 <div class="zTreeDemoBackground left"> 63 <ul id="treeDemo" class="ztree"></ul> 64 </div> 65 </div> 66 </BODY> 67 </HTML>
标签:
原文地址:http://www.cnblogs.com/liubeimeng/p/4877184.html