I just refer this link to get idea how to get the column total in jquery data tables. But I have done half of my project. I do not have any definition in html page. all include in Jquery side.
In HTML
Defined data table like below in Jquery.
tblColectionData = $("#tblCollection").DataTable({
"ordering": true,
columns: [
{ title: 'OrderId', data: 'OrderId' },
{ title: 'Ordered Date', data: 'OrderPlaceDateTime' },
{ title: 'Customer Name', data: 'CustomerName' },
{ title: 'Restaurant Name', data: 'RestaurantName' },
{ title: 'Order Total', data: 'OrderTotalAmount' }
],
});
How to add footerCallback part in my case? The example in web link is defined the total in tfoot. In my case it is not. How to do this?
EDIT 1
Fill data to datatable
$.ajax({
type: 'post',
url: serverLocation + "/api/dashboard/getOrderData",
dataType: 'json',
data: JSON.stringify(reqJson),
contentType: "application/json; charset=UTF-8",
success: function (response) {
tblColectionData.clear().draw();
tblColectionData.rows.add(response).draw();
},
error: function (textStatus, errorThrown) {
console.log('Err');
}
});