Datatables Ajax Reload
var table = $('#example').DataTable( {
ajax: "data.json"
} );
setInterval( function () {
table.ajax.reload();
}, 30000 );
Bad Bug
var table = $('#example').DataTable( {
ajax: "data.json"
} );
setInterval( function () {
table.ajax.reload();
}, 30000 );
// table.ajax.reload(callback, resetPaging)
table.ajax.reload(null, false)
table.ajax.reload(null, false)
Javascript12345var table = $('#example').DataTable(); table.ajax.reload( function ( json ) { $('#myInput').val( json.lastInput );} );
$('#table').dataTable().fnClearTable();
$('#table').dataTable().fnAddData(data);
//declare this var
dtElement: DataTableDirective;
//create method and call it where ever you want to refresh your table
reload(): void {
this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => {
dtInstance.draw();
});
}