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
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)
DataTable.ext.errMode( settings, techNote, message )
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 ( | |||
2 | techNote | No | |
Technical note reference which contains detailed information about the error that has occurred - this can be found at | |||
3 | message | No | |
Error message |
Returns:
undefined
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.