checkbox_nocheck.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO - no checkbox</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. <!--
  12. <script type="text/javascript" src="../../../js/jquery.ztree.exedit-3.5.js"></script>
  13. -->
  14. <SCRIPT type="text/javascript">
  15. <!--
  16. var setting = {
  17. check: {
  18. enable: true,
  19. nocheckInherit: true
  20. },
  21. data: {
  22. simpleData: {
  23. enable: true
  24. }
  25. }
  26. };
  27. var zNodes =[
  28. { id:1, pId:0, name:"随意勾选 1", open:true},
  29. { id:11, pId:1, name:"随意勾选 1-1", open:true},
  30. { id:111, pId:11, name:"无 checkbox 1-1-1", nocheck:true},
  31. { id:112, pId:11, name:"随意勾选 1-1-2"},
  32. { id:12, pId:1, name:"无 checkbox 1-2", nocheck:true, open:true},
  33. { id:121, pId:12, name:"无 checkbox 1-2-1"},
  34. { id:122, pId:12, name:"无 checkbox 1-2-2"},
  35. { id:2, pId:0, name:"随意勾选 2", checked:true, open:true},
  36. { id:21, pId:2, name:"随意勾选 2-1"},
  37. { id:22, pId:2, name:"随意勾选 2-2", open:true},
  38. { id:221, pId:22, name:"随意勾选 2-2-1", checked:true},
  39. { id:222, pId:22, name:"随意勾选 2-2-2"},
  40. { id:23, pId:2, name:"随意勾选 2-3"}
  41. ];
  42. function nocheckNode(e) {
  43. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  44. nocheck = e.data.nocheck,
  45. nodes = zTree.getSelectedNodes();
  46. if (nodes.length == 0) {
  47. alert("请先选择一个节点");
  48. }
  49. for (var i=0, l=nodes.length; i<l; i++) {
  50. nodes[i].nocheck = nocheck;
  51. zTree.updateNode(nodes[i]);
  52. }
  53. }
  54. $(document).ready(function(){
  55. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  56. $("#nocheckTrue").bind("click", {nocheck: true}, nocheckNode);
  57. $("#nocheckFalse").bind("click", {nocheck: false}, nocheckNode);
  58. });
  59. //-->
  60. </SCRIPT>
  61. </HEAD>
  62. <BODY>
  63. <h1>Checkbox nocheck 演示</h1>
  64. <h6>[ 文件路径: excheck/checkbox_nocheck.html ]</h6>
  65. <div class="content_wrap">
  66. <div class="zTreeDemoBackground left">
  67. <ul id="treeDemo" class="ztree"></ul>
  68. </div>
  69. <div class="right">
  70. <ul class="info">
  71. <li class="title"><h2>1、setting 配置信息说明</h2>
  72. <ul class="list">
  73. <li>这个 Demo 只简单演示 nocheck 的使用方法,详细配置信息请参考 ‘Checkbox 勾选操作’</li>
  74. <li class="highlight_red">setting.check.nocheckInherit 可以设置子节点自动继承父节点的 nocheck 属性,详细请参见 API 文档中的相关内容</li>
  75. <li><p>试试看:<br/>
  76. &nbsp;&nbsp;&nbsp;&nbsp;[ <a id="nocheckTrue" href="#" title="set checkbox to be hidden." onclick="return false;">隐藏</a> ]
  77. &nbsp;&nbsp;&nbsp;&nbsp;[ <a id="nocheckFalse" href="#" title="set checkbox to be show." onclick="return false;">显示</a> ]
  78. </li>
  79. </ul>
  80. </li>
  81. <li class="title"><h2>2、treeNode 节点数据说明</h2>
  82. <ul class="list">
  83. <li class="highlight_red">1)、如果某节点不显示 checkbox,请设置 treeNode.nocheck 属性,详细请参见 API 文档中的相关内容</li>
  84. <li>2)、其他请参考 ‘Checkbox 勾选操作’</li>
  85. </ul>
  86. </li>
  87. </ul>
  88. </div>
  89. </div>
  90. </BODY>
  91. </HTML>