Totals on Server-Side
Totals on Server-Side
Hi there,
I have got a problem because want to show a sum of all the totals in all my pagination pages. Obviously since I only print the current page data I dont have that total, so I thought to calculate it when I call the file via ajax and then add it to the JSON response. Since I dont want to send on each row the BigTotal, added it on the firest line of the JSON with draw, recordsTotal and so and its called "BigTotal".
My problem comes that I dont know how to receive that element on the JS.
//JSON
{"draw":2,"recordsTotal":17,"recordsFiltered":17,"BigTotal":"21384.44$","data":[
{"DT_RowId":"row_0","estado":"<span class=\"text-green\" title=\"Confirmado\"><i class=\"fa fa-lock\"></i> Confirmado</span>","gasto":"<span title=\"Ticket\">Ticket</span>","fecha_gasto":"15/07/2016","fecha_envio":"15/07/2016","etiquetas":"PAOPAO DIGITAL, S.L.","nif":"","proveedor":"","base_imp":"","por_iva":"","imp_iva":"","total":"4,60€","acciones":""}
]}
//JS
var dt = $('#mis-justificantes').DataTable( {
processing: true,
bServerSide: true,
ajax: {
"url": "/ajax",
"type": "POST",
"data" : function ( d ) {
}
},
order: [[4, 'desc']],
iDisplayLength: 10
});
Thanks in advance for the help