I'd like to update dom elements after the default datatable updates are completed, such as searching and sorting. The problem is the following event listening fires before the actual sort or search: I want my code to execute after the sort or search is completed. Thank you.
$('#dTable').DataTable({
"numbering": false,
"searching": true,
"paging": true,
"ordering": true,
"bLengthChange": false,
'iDisplayLength': 10,
"info": false,
"scrollCollapse": true,
}).on('draw', function () {
//my dom update code -- problem is my update code executes before the sort or search is completed;
//i want my code to execute only after its completed
$(".dom_element").html("sort or search completed");
});
figured it out!!
$('#dTable').DataTable({
"numbering": false,
"searching": true,
"paging": true,
"ordering": true,
"bLengthChange": false,
'iDisplayLength': 10,
"info": false,
"scrollCollapse": true,
"fnDrawCallback": function () {
//write dom update code here...
return false;
}
})