Hi,
I have a table where i used footer callback like in the example https://datatables.net/examples/advanced_init/footer_callback.html
at certain point if any data in the table is changed I refresh the table like so
$.ajax({
url: myurl,
type: "GET",
dataType: "html",
success: function (data) {
$('#placeHere').html(data);
},
});
but than when i use a dropdwon then to search this table
myTable.columns(6).search(this.value).draw();
then during the redrawing in footercallback array variable in api() is empty.
"footerCallback": function (row, data, start, end, display) {
var api = this.api(), data;
// Remove the formatting to get integer data for summation
var intVal = function (i) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '') * 1 :
typeof i === 'number' ?
i : 0;
};
Q1 = api
.column(1, { page: 'current' })
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
I have been strugelling with this for a while, any idea why can't i use draw() after i use ajax to refresh data in a table ?
Would appriciate any suggestions.