setting.async.otherParam.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>Array(String) / JSON / Function(treeId, treeNode)</span><span class="path">setting.async.</span>otherParam
  4. </h2>
  5. <h3>Overview<span class="h3_info">[ depends on <span
  6. class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
  7. <div class="desc">
  8. <p></p>
  9. <div class="longdesc">
  10. <p>The query parameters of the Ajax request. (key - value) It is valid when <span class="highlight_red">[setting.async.enable = true]</span>
  11. </p>
  12. <p>Default: [ ]</p>
  13. </div>
  14. </div>
  15. <h3>Array(String) Format</h3>
  16. <div class="desc">
  17. <p>Can be an empty array. e.g. [ ]. The array should contain key value pairs, e.g. [key, value]. (Either or
  18. [key] or [key, value, key] is wrong!!)</p>
  19. </div>
  20. <h3>JSON Format</h3>
  21. <div class="desc">
  22. <p>Use JSON hash data to set the key-value pairs. e.g. { key1:value1, key2:value2 }</p>
  23. </div>
  24. <h3>Function Parameter Descriptions</h3>
  25. <div class="desc">
  26. <h4><b>treeId</b><span>String</span></h4>
  27. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  28. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  29. <p>Parent node's JSON data object</p>
  30. <p class="highlight_red">When asynchronously loading the root, the treeNode = null</p>
  31. <h4 class="topLine"><b>Return </b><span>Array(String) || JSON</span></h4>
  32. <p>Return value is same as 'Array(String) || JSON Format'</p>
  33. </div>
  34. <h3>Examples of setting</h3>
  35. <h4>1. Using Array(String) Format</h4>
  36. <pre xmlns=""><code>var setting = {
  37. async: {
  38. enable: true,
  39. url: "http://host/getNode.php",
  40. <span style="color:red">otherParam: ["id", "1", "name", "test"]</span>
  41. }
  42. };
  43. when zTree sends the ajax request, the query string will be like this: id=1&name=test</code></pre>
  44. <h4>2. Using JSON data Format</h4>
  45. <pre xmlns=""><code>var setting = {
  46. async: {
  47. enable: true,
  48. url: "http://host/getNode.php",
  49. <span style="color:red">otherParam: { "id":"1", "name":"test"}</span>
  50. }
  51. };
  52. when zTree sends the ajax request, the query string will be like this: id=1&name=test</code></pre>
  53. </div>
  54. </div>