setting.data.simpleData.enable.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Boolean</span><span class="path">setting.data.simpleData.</span>enable</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span
  5. class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
  6. <div class="desc">
  7. <p></p>
  8. <div class="longdesc">
  9. <p>Set zTree's node to accept the simple data format, when zTree is initialized or when ajax get / or
  10. when use <span class="highlight_red">addNodes</span> method.</p>
  11. <p>Don't have to generate the complex nested data.</p>
  12. <p>Default: false</p>
  13. </div>
  14. </div>
  15. <h3>Boolean Format</h3>
  16. <div class="desc">
  17. <p> true means: zTree's node accept the simple data format.</p>
  18. <p> false means: zTree's node only accept the nested data format.</p>
  19. <p class="highlight_red">If set it is true, you must set the other attributes in 'setting.data.simpleData'.
  20. (e.g., idKey, pIdKey, rootPId) And let the data satisfy the parent-child relationship.</p>
  21. </div>
  22. <h3>Examples of setting</h3>
  23. <h4>1. use the simple data format</h4>
  24. <pre xmlns=""><code>var setting = {
  25. data: {
  26. simpleData: {
  27. enable: true,
  28. idKey: "id",
  29. pIdKey: "pId",
  30. rootPId: 0
  31. }
  32. }
  33. };
  34. var treeNodes = [
  35. {"id":1, "pId":0, "name":"test1"},
  36. {"id":11, "pId":1, "name":"test11"},
  37. {"id":12, "pId":1, "name":"test12"},
  38. {"id":111, "pId":11, "name":"test111"}
  39. ];
  40. ......</code></pre>
  41. </div>
  42. </div>