EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on February 25, 2013, 09:48:32 PM



Title: Cause Of onLoadError
Post by: devnull on February 25, 2013, 09:48:32 PM
is it possible to show (in the console) the reason for the load error, or the data that caused the error ?

Right now I am outputting the responseText which echos the data received, this is helpful but it would be great to actually report the data that caused the failure ??

EDIT
===
I have attempted a parseJSON() on the data, that seems to be more helpful:

Code:
function loadError(data){try { var c = $.parseJSON(data.responseText);} catch (err) {console.log(err);}}

Is there a better or more informative method ??

Thanks




Title: Re: Cause Of onLoadError
Post by: stworthy on February 25, 2013, 11:15:28 PM
Try using the following code to get more information caused errors.
Code:
$('#dg').datagrid({
  onLoadError: function(XMLHttpRequest, textStatus, errorThrown){
    // ...
  }
});


Title: Re: Cause Of onLoadError
Post by: devnull on February 26, 2013, 12:17:02 AM
Thanks, but that gives me the same info as my existing function, which is basically a parseError.

What I was interested in was the actual data that caused the error i.e.

"someField":undefined

Thanks


Title: Re: Cause Of onLoadError
Post by: stworthy on February 26, 2013, 02:03:10 AM
Many factors may cause errors while loading data. It is difficult to detect what cause errors. The 'loader', 'loadFilter', 'onLoadSuccess' or 'onLoadError' can be used to process this logic according to the specified requirements.