datatables server side processing reload table

datatables server side processing reload table

DisabledgDisabledg Posts: 4Questions: 2Answers: 0

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

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
    Answer ✓

    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

  • DisabledgDisabledg Posts: 4Questions: 2Answers: 0

    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?

  • DisabledgDisabledg Posts: 4Questions: 2Answers: 0

    This solve problem with reload and stay on page:
    setTimeout(function(){$('#table_data').DataTable().ajax.reload(null, false);}, 1000);

This discussion has been closed.