How to get updated data without redrawing a table

How to get updated data without redrawing a table

DimaByDimaBy Posts: 2Questions: 1Answers: 0

Hi,

I'm using DT with AJAX cal like:

ajax: {
url :'data.php', // json datasource
type: 'post', // method , by default get
data: function ( d ) {
d.act = 'ajax-get-data';
d.range = '90';
},
},

everything is OK.

After I can use ajax.reload() for data refreshing... But for some cases I need new updated data before draw() and populate the table row-by-row with additional manipulations. Do we have a feature how to get that data from server into array without other movings? I can make it using separate custom ajax call but I have to gather and send all the data like pages, sorting, search etc. (((

Answers

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,948
    edited July 2020

    I can make it using separate custom ajax call but I have to gather and send all the data like pages, sorting, search etc.

    It sounds like you have server side processing enabled. Is that correct?

    Do we have a feature how to get that data from server into array without other movings?

    You an use a jQuery ajax() along with rows.add() to fetch and add data to the table.

    But for some cases I need new updated data before draw() and populate the table row-by-row with additional manipulations.

    columns.render is the typical way to manipulate the row data.

    If this doesn't help then please provide more specifics about your solution, ie, post your Datatables init code. And specifics of how you want to fetch the new data and manipulate it.

    Kevin

  • DimaByDimaBy Posts: 2Questions: 1Answers: 0

    solution found:

    $.post('', tbl.ajax.params(), // using params() sending data of pages, search, sorting etc to the server
    function(data, status){
    var dt = $.parseJSON(data);
    console.log(dt);
    }
    );

    really easy )))

This discussion has been closed.