i want to add the loader when datatbles in processing during search , fileter , and onload
var dtable= $("table#pagination-2").DataTable(
{
"language": {
"processing": "<img src='image-path'>"
},
"processing": true,
"serverSide": true,
"order": [],
"ajax":
{
"url": dataTableURL,
"type": "POST",
},
"columnDefs": [
{
"targets": [0],
"orderable": true
}],
'aoColumnDefs': [{
'bSortable': false,
'aTargets': [-1,-2,-3]
}],
"initComplete": function()
{
$(".dataTables_filter input")
.unbind() // Unbind previous default bindings
.bind("input", function(e)
{ // Bind our desired behavior
// If the length is 3 or more characters, or the user pressed ENTER, search
if(this.value.length > 3)
{
// Call the API search function
// $(".input-sm").attr('readonly', true);
dtable.search(this.value).draw();
// setTimeout(function() {
// $(".input-sm").removeAttr('readonly');
// }, 2000);
}
// Ensure we clear the search if they backspace far enough
if(this.value == "")
{
dtable.search("").draw();
}
return;
});
},
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.