radio.html 3.5 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:"随意勾选 1", open:true},
  30. { id:11, pId:1, name:"随意勾选 1-1", open:true},
  31. { id:111, pId:11, name:"随意勾选 1-1-1"},
  32. { id:112, pId:11, name:"随意勾选 1-1-2"},
  33. { id:12, pId:1, name:"随意勾选 1-2", open:true},
  34. { id:121, pId:12, name:"随意勾选 1-2-1"},
  35. { id:122, pId:12, name:"随意勾选 1-2-2"},
  36. { id:2, pId:0, name:"随意勾选 2", open:true},
  37. { id:21, pId:2, name:"随意勾选 2-1"},
  38. { id:22, pId:2, name:"随意勾选 2-2", open:true},
  39. { id:221, pId:22, name:"随意勾选 2-2-1", checked:true},
  40. { id:222, pId:22, name:"随意勾选 2-2-2"},
  41. { id:23, pId:2, name:"随意勾选 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 勾选操作</h1>
  65. <h6>[ 文件路径: 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、setting 配置信息说明</h2>
  73. <ul class="list">
  74. <li class="highlight_red">使用 radio,必须设置 setting.check 中的各个属性,详细请参见 API 文档中的相关内容</li>
  75. <li><p>radio 分组范围:<input type="radio" id="level" class="radio first" name="radioGroup" checked /><span>同一级内</span>
  76. <input type="radio" id="all" class="radio" name="radioGroup"/><span>整棵树内</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、treeNode 节点数据说明</h2>
  82. <ul class="list">
  83. <li class="highlight_red">1)、如果需要初始化默认节点被勾选,请设置 treeNode.checked 属性,详细请参见 API 文档中的相关内容</li>
  84. <li class="highlight_red">2)、如果某节点不显示 radio,请设置 treeNode.nocheck 属性,详细请参见 API 文档中的相关内容</li>
  85. <li class="highlight_red">3)、如果更换 checked 属性,请参考 API 文档中 setting.data.key.checked 的详细说明</li>
  86. <li>4)、其他请参考 API 文档中 treeNode.checkedOld / getCheckStatus / check_Child_State / check_Focus 的详细说明</li>
  87. </ul>
  88. </li>
  89. </ul>
  90. </div>
  91. </div>
  92. </BODY>
  93. </HTML>