zTreeObj.setChkDisabled.html 3.1 KB

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