{hero}

DataTable.ext.errMode

Since: DataTables 1.10

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 error
  • throw - Throw a Javascript error
  • none - Do nothing (you would want to use this 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:
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.