How to get updated data without redrawing a table
How to get updated data without redrawing a table
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
It sounds like you have server side processing enabled. Is that correct?
You an use a jQuery ajax() along with
rows.add()
to fetch and add data to the table.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
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 )))