Specify error handler before initialization

Specify error handler before initialization

nin_boundnin_bound Posts: 10Questions: 6Answers: 1

https://datatables.net/reference/event/error

$.fn.dataTable.ext.errMode = 'none';

$('#example')
.on( 'error.dt', function ( e, settings, techNote, message ) {
console.log( 'An error has been reported by DataTables: ', message );
} )
.DataTable();

I use DataTable on numerous pages and I'm trying to keep it standard.

Is there a way, before I declare the table, to specify on('error.dt', function) on the main page?

Would be great if I could handle different technotes appropriately. Mostly, I want to get technote 7 to throw "Hey, try refreshing the page again" and every other technote to say "Hey, something has gone wrong. Please contact web dev"

This discussion has been closed.