setting.callback.onAsyncError.html 2.3 KB

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