How to reload in jquery datatable when callback draw?
How to reload in jquery datatable when callback draw?
matt.crawfoord
Posts: 31Questions: 13Answers: 0
I have a jquery DataTable is server-side processing mode .
How to add setTimeout function when server side callback like this
my code as below,
$(document).ready(function() {
$.fn.dataTable.ext.errMode = 'none';
var table = $('#example').DataTable( {
"processing": true,
"serverSide": true,
"jQueryUI": true,
"ordering": true,
"order": [[1, 'desc']],//default
"lengthMenu": [
[50, 100, 1000],
[50, 100, 1000]
],
"ajax": function ( data, callback, settings ) {
url: "process.php",
type: "POST",
data: {
start: "<?php echo $start; ?>",
end: "<?php echo $start; ?>"
},
setTimeout( function () {
callback( {
draw: data.draw,
data: aaData,
recordsTotal: data.recordsTotal,
recordsFiltered: data.recordsFiltered
} );
}, 50 );
},
"columns": [
{
"className":'details-control',
"orderable":false,
"data":null,
"defaultContent": ''
},
{ "data": "time"},
{ "data": "message","orderable": false}
],
"dom": 'frtiS',
"scrollY": 600,
"scroller": {
"loadingIndicator": true
},
"deferRender": true
} );
Obviously this doesn't work ,
Can someone point me out the correct way to do it.
Thanks,
This discussion has been closed.