setting.callback.onAsyncError.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span class="path">setting.callback.</span>onAsyncError</h2>
  4. <h2><span>Function(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown)</span>&nbsp;</h2>
  5. <h3>Overview<span class="h3_info">[ depends on <span class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
  6. <div class="desc">
  7. <p></p>
  8. <div class="longdesc">
  9. <p>Used to capture the error event when execute ajax.</p>
  10. <p class="highlight_red">If you set 'setting.callback.beforeAsync',and return false, zTree will not execute ajax, and will not trigger the 'onAsyncSuccess / onAsyncError' callback.</p>
  11. <p>Default: null</p>
  12. </div>
  13. </div>
  14. <h3>Function Parameter Descriptions</h3>
  15. <div class="desc">
  16. <h4><b>event</b><span>js event Object</span></h4>
  17. <p>event Object</p>
  18. <h4 class="topLine"><b>treeId</b><span>String</span></h4>
  19. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  20. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  21. <p>JSON data object of the parent node</p>
  22. <p class="highlight_red">When load root nodes, treeNode = null</p>
  23. <h4 class="topLine"><b>XMLHttpRequest</b><span>String</span></h4>
  24. <p>XMLHttpRequest Object, please refer to JQuery API documentation.</p>
  25. <h4 class="topLine"><b>textStatus</b><span>String</span></h4>
  26. <p>a string categorizing the status of the request("success", "error"...), please refer to JQuery API documentation.</p>
  27. <h4 class="topLine"><b>errorThrown</b><span>String</span></h4>
  28. <p>eWhen an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, please refer to JQuery API documentation.</p>
  29. </div>
  30. <h3>Examples of setting & function</h3>
  31. <h4>1. When execute ajax make error, alert message.</h4>
  32. <pre xmlns=""><code>function myOnAsyncError(event, treeId, treeNode, XMLHttpRequest, textStatus, errorThrown) {
  33. alert(XMLHttpRequest);
  34. };
  35. var setting = {
  36. callback: {
  37. onAsyncError: myOnAsyncError
  38. }
  39. };
  40. ......</code></pre>
  41. </div>
  42. </div>