Keep in same page when updating table using ajax and pipelining

Keep in same page when updating table using ajax and pipelining

aagrlp640aagrlp640 Posts: 3Questions: 1Answers: 0
edited January 2021 in Free community support

Hi, im using pipelining datatable option and everything works great. I have an interval that refresh the table, but the problem is that when I update the table it goes to the first page, and i want to stay in current page,
Im using this function to update table
$('#myTable').DataTable().clearPipeline().draw();

I need to do something like this
$('#myTable').DataTable().ajax.reload(null, false); that work when no using pipelining

$(document).ready(function(){
    var table = $("#myTable").DataTable({
        'processing': ajax_tables,
        'serverSide': true,
        'serverMethod': 'post',
        'ajax': $.fn.dataTable.pipeline({
            url:'load_users.php',
            pages: 5,///number of pages to cache
        }),
        "columns": [
            {"data": "id"},
            {"data": "name"},
            {"data": "lastname"}
        ],
        "initComplete": function(){
            setInterval(function(){
                ///Without pipeline this update table and keep in current page
                ///$('#myTable').DataTable().ajax.reload(null, false);
                ///I want to refresh table but stay in same page like option above
                $('#myTable').DataTable().clearPipeline().draw();
            }, 5000);
        },
    });
});

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.