radio.html 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO - radio</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. chkStyle: "radio",
  20. radioType: "level"
  21. },
  22. data: {
  23. simpleData: {
  24. enable: true
  25. }
  26. }
  27. };
  28. var zNodes =[
  29. { id:1, pId:0, name:"can check 1", open:true},
  30. { id:11, pId:1, name:"can check 1-1", open:true},
  31. { id:111, pId:11, name:"can check 1-1-1"},
  32. { id:112, pId:11, name:"can check 1-1-2"},
  33. { id:12, pId:1, name:"can check 1-2", open:true},
  34. { id:121, pId:12, name:"can check 1-2-1"},
  35. { id:122, pId:12, name:"can check 1-2-2"},
  36. { id:2, pId:0, name:"can check 2", checked:true, open:true},
  37. { id:21, pId:2, name:"can check 2-1"},
  38. { id:22, pId:2, name:"can check 2-2", open:true},
  39. { id:221, pId:22, name:"can check 2-2-1", checked:true},
  40. { id:222, pId:22, name:"can check 2-2-2"},
  41. { id:23, pId:2, name:"can check 2-3"}
  42. ];
  43. var code;
  44. function setCheck() {
  45. var type = $("#level").attr("checked")? "level":"all";
  46. setting.check.radioType = type;
  47. showCode('setting.check.radioType = "' + type + '";');
  48. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  49. }
  50. function showCode(str) {
  51. if (!code) code = $("#code");
  52. code.empty();
  53. code.append("<li>"+str+"</li>");
  54. }
  55. $(document).ready(function(){
  56. setCheck();
  57. $("#level").bind("change", setCheck);
  58. $("#all").bind("change", setCheck);
  59. });
  60. //-->
  61. </SCRIPT>
  62. </HEAD>
  63. <BODY>
  64. <h1>Radio Operation</h1>
  65. <h6>[ File Path: excheck/radio.html ]</h6>
  66. <div class="content_wrap">
  67. <div class="zTreeDemoBackground left">
  68. <ul id="treeDemo" class="ztree"></ul>
  69. </div>
  70. <div class="right">
  71. <ul class="info">
  72. <li class="title"><h2>1, Explanation of setting</h2>
  73. <ul class="list">
  74. <li class="highlight_red">Must set setting.check attributes, see the API documentation for more related contents.</li>
  75. <li><p>group range of radio: <br/><input type="radio" id="level" class="radio first" name="radioGroup" checked /><span>within the same level</span>
  76. <input type="radio" id="all" class="radio" name="radioGroup"/><span>within the whole tree</span><br/>
  77. <ul id="code" class="log" style="height:20px;"></ul></p>
  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 is checked, please set treeNode.checked attribute. See the API documentation for more related contents.</li>
  84. <li class="highlight_red">2), If you need to initialize the node don't show radio, please set treeNode.nocheck attribute. See the API documentation for more related contents.</li>
  85. <li class="highlight_red">3), If you need to change 'checked' to other attribute, please set setting.data.key.checked attribute. See the API documentation for more related contents.</li>
  86. <li>4), By the way, please see the API documentation for 'treeNode.checkedOld / getCheckStatus / check_Child_State / check_Focus'.</li>
  87. </ul>
  88. </li>
  89. </ul>
  90. </div>
  91. </div>
  92. </BODY>
  93. </HTML>