zTreeObj.setChkDisabled.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Function(node, disabled, inheritParent, inheritChildren)</span><span class="path">zTreeObj.</span>setChkDisabled</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.excheck</span> js ]</span></h3>
  5. <div class="desc">
  6. <p></p>
  7. <div class="longdesc">
  8. <p>Set the node's checkbox or radio is disabled or remove disabled. It is valid when <span class="highlight_red">[setting.check.enable = true]</span></p>
  9. <p class="highlight_red">1. After the node's checkbox / radio is disabled, it can not be checked or unchecked, but it can affect the half-checked status of the parent node.</p>
  10. <p class="highlight_red">2. Please do not directly modify the 'chkDisabled' attribute of the loaded node.</p>
  11. <p class="highlight_red">3. Please use zTree object to executing the method.</p>
  12. </div>
  13. </div>
  14. <h3>Function Parameter Descriptions</h3>
  15. <div class="desc">
  16. <h4><b>treeNode</b><span>JSON</span></h4>
  17. <p>JSON data object of the node which need to be checked or unchecked.</p>
  18. <p class="highlight_red">Please ensure that this data object is an internal node data object in zTree.</p>
  19. <h4 class="topLine"><b>disabled</b><span>Boolean</span></h4>
  20. <p>disabled = true means: the node's checkbox / radio is disabled.</p>
  21. <p>disabled = false means: the node's checkbox / radio is removed disabled.</p>
  22. <p class="highlight_red">If this parameter is omitted, it is same as disabled = false </p>
  23. <p class="highlight_red">Don't affect the node which 'nochecked' attribute is true.</p>
  24. <h4 class="topLine"><b>inheritParent</b><span>Boolean</span></h4>
  25. <p>inheritParent = true means: all parent nodes's disabled status will be same as this node.</p>
  26. <p>inheritParent = false means: all parent nodes's disabled status will be not affected.</p>
  27. <p class="highlight_red">If this parameter is omitted, it is same as 'inheritParent = false'</p>
  28. <h4 class="topLine"><b>inheritChildren</b><span>Boolean</span></h4>
  29. <p>inheritChildren = true means: all child nodes's disabled status will be same as this node.</p>
  30. <p>inheritChildren = false means: all child nodes's disabled status will be not affected.</p>
  31. <p class="highlight_red">If this parameter is omitted, it is same as 'inheritChildren = false'</p>
  32. <h4 class="topLine"><b>Return </b><span>none</span></h4>
  33. <p>no return value</p>
  34. </div>
  35. <h3>Examples of function</h3>
  36. <h4>1. Set the selected nodes's checkbox / radio to disable.</h4>
  37. <pre xmlns=""><code>var treeObj = $.fn.zTree.getZTreeObj("tree");
  38. var nodes = treeObj.getSelectedNodes();
  39. for (var i=0, l=nodes.length; i < l; i++) {
  40. treeObj.setChkDisabled(nodes[i], true);
  41. }
  42. </code></pre>
  43. </div>
  44. </div>