setting.async.otherParam.html 2.0 KB

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