radio_chkDisabled.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO - Radio chkDisabled</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:"disabled 1-1-1", chkDisabled:true, checked:true},
  32. { id:112, pId:11, name:"随意勾选 1-1-2"},
  33. { id:12, pId:1, name:"disabled 1-2", chkDisabled:true, open:true},
  34. { id:121, pId:12, name:"disabled 1-2-1", checked:true},
  35. { id:122, pId:12, name:"disabled 1-2-2"},
  36. { id:2, pId:0, name:"随意勾选 2", checked:true, 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. function disabledNode(e) {
  44. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  45. disabled = e.data.disabled,
  46. nodes = zTree.getSelectedNodes();
  47. if (nodes.length == 0) {
  48. alert("请先选择一个节点");
  49. }
  50. for (var i=0, l=nodes.length; i<l; i++) {
  51. zTree.setChkDisabled(nodes[i], disabled);
  52. }
  53. }
  54. $(document).ready(function(){
  55. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  56. $("#disabledTrue").bind("click", {disabled: true}, disabledNode);
  57. $("#disabledFalse").bind("click", {disabled: false}, disabledNode);
  58. });
  59. //-->
  60. </SCRIPT>
  61. </HEAD>
  62. <BODY>
  63. <h1>Radio chkDisabled 演示</h1>
  64. <h6>[ 文件路径: excheck/radio_chkDisabled.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、setChkDisabled 方法操作说明</h2>
  72. <ul class="list">
  73. <li>setChkDisabled 方法可以设置节点 checkbox / radio 禁用 或 取消禁用,详细请参见 API 文档中的相关内容</li>
  74. <li><p>试试看:<br/>
  75. &nbsp;&nbsp;&nbsp;&nbsp;[ <a id="disabledTrue" href="#" title="set checkbox to be disabled." onclick="return false;">禁用</a> ]
  76. &nbsp;&nbsp;&nbsp;&nbsp;[ <a id="disabledFalse" href="#" title="set checkbox to be abled." onclick="return false;">取消禁用</a> ]</p>
  77. </li>
  78. </ul>
  79. </li>
  80. <li class="title"><h2>2、setting 配置信息说明</h2>
  81. <ul class="list">
  82. <li>这个 Demo 只简单演示 chkDisabled 的使用方法,详细配置信息请参考 ‘Radio 勾选操作’</li>
  83. </ul>
  84. </li>
  85. <li class="title"><h2>3、treeNode 节点数据说明</h2>
  86. <ul class="list">
  87. <li class="highlight_red">1)、如果某节点不显示 radio,请设置 treeNode.chkDisabled 属性,详细请参见 API 文档中的相关内容</li>
  88. <li>2)、其他请参考 ‘Radio 勾选操作’</li>
  89. </ul>
  90. </li>
  91. </ul>
  92. </div>
  93. </div>
  94. </BODY>
  95. </HTML>