DataTable.ext.errMode
Set how DataTables will report detected errors.
Description
If DataTables encounters an error that it "knows about" (invalid JSON for example), it can provide useful information that describes the error and how to address it.
The default error handling is intentionally obtrusive to let developers know that there is an issue while they are writing code that interfaces with DataTables. However, this is not always what you might wish to have on your page and this static option provides the ability to control how errors are reported.
Types
string
- Description:
Perform one of the built in error reporting actions:
alert
(default) - Alert the errorthrow
- Throw a Javascript errornone
- Do nothing (you would want to use thisdt-error
in this case)
function DataTable.ext.errMode( settings, techNote, message )
- Description:
As a function you may provide your own error handling, for example showing a message to the end user or reloading the page to recover from an error situation.
- Parameters:
Name Type Optional 1 settings
No DataTables settings object (
DataTables.Settings
).2 techNote
No Technical note reference which contains detailed information about the error that has occurred - this can be found at
https://datatables.net/tn/{techNote}
.3 message
No Error message
- Returns:
No return is excepted or acted upon.
Example
Have DataTables throw
errors rather than alert()
them.:
DataTable.ext.errMode = 'throw';
new DataTable('#myTable', {
ajax: 'data.json'
});
Related
The following options are directly related and may also be useful in your application development.