Disable error reporting?
Disable error reporting?
andrew2311
Posts: 11Questions: 0Answers: 0
I have noticed that in some cases datatables will pop up an alert ("Invalid JSON"). Is there any way to disable this?
This discussion has been closed.
Replies
In all seriousness, you can have DataTables throw an error rather than 'alert'ing it by using:
[code]
$.fn.dataTableExt.sErrMode = 'throw';
[/code]
But really valid JSON would be the way to go, since the error is there for a reason :-)
Allan
I do use valid JSON it's just that sometimes the issue is out of my control - I have my datatables refreshing from the server and if the user undeploys the web app the datatables will get a 404 which obviously isn't valid JSON :-)
Allan
In Internet Explorer an alert is not shown but in Chrome (17) and Firefox (10) the alert is still shown. If you click that link above and then push 'render' you should see it.
Any ideas?
This code:
[code] "error": function (xhr, error, thrown) {
if ( error == "parsererror" ) {
alert( "DataTables warning: JSON data from server could not be parsed. "+
"This is caused by a JSON formatting error." );
}
}
[/code]
Does not call _fnLog, which is what checks sErrMode
This is in the 1.9.1.dev nightly version (available on the downloads page) and will be included in the 1.9.1 release.
Regards,
Allan