datatables server side processing reload table
datatables server side processing reload table
![Disabledg](https://secure.gravatar.com/avatar/c5bbf3a2c74d137a4b76480a55613e1b/?default=https%3A%2F%2Fvanillicon.com%2Fc5bbf3a2c74d137a4b76480a55613e1b_200.png&rating=g&size=120)
Hello! I'm using datatables with server side processing. Need to reload data after changes dynamically. But .reload not working. Console log is clear.
DataTables 1.10.15
Init:
$('#table_data').DataTable( {
"processing": true,
"serverSide": true,
"order": [[ 0, "desc" ]],
"ajax": "server_processing.php?forpage=datawork&table_name=<?php echo $_GET["table_name"];?>"
});
Reload that i try:
$('#table_data').DataTable().ajax.reload();
$('#table_data').DataTable().api().ajax.reload();
$('#table_data').dataTable().api().ajax.reload();
$('#table_data').dataTable().ajax.reload();
What i'm doing wrong?
This question has an accepted answers - jump to answer
Answers
The first option you have works. Checkout this server side processing example:
http://live.datatables.net/fecoqexu/1/edit
If it's not working for you then you will need to see your page or a test case replicating the issue.
Kevin
This solve problem with reload:
setTimeout(function(){$('#table_data').DataTable().ajax.reload();}, 1000);
But another problem - after reload start page is 1. Is it possible to open page what user work with?
This solve problem with reload and stay on page:
setTimeout(function(){$('#table_data').DataTable().ajax.reload(null, false);}, 1000);