checkbox_nocheck.html 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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:"can check 1", open:true},
  29. { id:11, pId:1, name:"can check 1-1", open:true},
  30. { id:111, pId:11, name:"no checkbox 1-1-1", nocheck:true},
  31. { id:112, pId:11, name:"can check 1-1-2"},
  32. { id:12, pId:1, name:"no checkbox 1-2", nocheck:true, open:true},
  33. { id:121, pId:12, name:"no checkbox 1-2-1"},
  34. { id:122, pId:12, name:"no checkbox 1-2-2"},
  35. { id:2, pId:0, name:"can check 2", checked:true, open:true},
  36. { id:21, pId:2, name:"can check 2-1"},
  37. { id:22, pId:2, name:"can check 2-2", open:true},
  38. { id:221, pId:22, name:"can check 2-2-1", checked:true},
  39. { id:222, pId:22, name:"can check 2-2-2"},
  40. { id:23, pId:2, name:"can check 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("Please select one node at first...");
  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 Demo</h1>
  64. <h6>[ File Path: 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, Explanation of setting</h2>
  72. <ul class="list">
  73. <li>This Demo only shows how use the ‘nocheck’ attribute, detailed configuration information, please refer to 'Checkbox Operation'</li>
  74. <li class="highlight_red">setting.check.nocheckInherit can set the child nodes to automatically inherit the parent node's 'nocheck' attribute. See the API documentation for more related contents.</li>
  75. <li><p>Try:<br/>
  76. &nbsp;&nbsp;&nbsp;&nbsp;[ <a id="nocheckTrue" href="#" title="set checkbox to be hidden." onclick="return false;">hide checkbox</a> ]
  77. &nbsp;&nbsp;&nbsp;&nbsp;[ <a id="nocheckFalse" href="#" title="set checkbox to be show." onclick="return false;">show checkbox</a> ]
  78. </li>
  79. </ul>
  80. </li>
  81. <li class="title"><h2>2, Explanation of treeNode</h2>
  82. <ul class="list">
  83. <li class="highlight_red">1), If you need to initialize the node don't show checkbox, please set treeNode.nocheck attribute. See the API documentation for more related contents.</li>
  84. <li>2), By the way, please see the 'Checkbox Operation' Demo.</li>
  85. </ul>
  86. </li>
  87. </ul>
  88. </div>
  89. </div>
  90. </BODY>
  91. </HTML>