EasyUI Forum
May 18, 2024, 01:23:52 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Cause Of onLoadError  (Read 16267 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« 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


« Last Edit: February 25, 2013, 09:57:17 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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){
    // ...
  }
});
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 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
Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!