I am writing an application using Data-table plugin. I want to handle the error thrown by plugin by my function but plugin always show a alert box with error message.
In the page load event, I am creating a datatable plugin and registering a handler.
function callOnLoad()
{
$.fn.dataTable.ext.errorMode = "none";
auditViewTable = $("#div").on("error.dt",function(e, settings, techNote, message ){
console.log("error");
})
.DataTable({
"processing": true,
"serverSide": true,
"ajax": "getData",
"columns": [
{ "data": "events" },
{ "data": "id" },
{ "data": "name" },
{ "data": "obj_id" },
{ "data": "obj" }
]
});
}
Please help me where I am going wrong.
See the documentation -> http://datatables.net/reference/event/error
error.dt
was first introduced in 1.10.5 !! So you must use at least 1.10.5. Proof of concept : works not, 1.10.4 example / works, 1.10.5 example.
The correct option to target is $.fn.dataTable.ext.errMode
.
A working example would be using >1.10.4 and
$.fn.dataTable.ext.errMode = 'none';
$('#example').on('error.dt', function(e, settings, techNote, message) {
console.log( 'An error has been reported by DataTables: ', message);
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With