Datatables automatically getting the sum of the column and displaying it using AJAX.
Datatables automatically getting the sum of the column and displaying it using AJAX.
bobs64956
Posts: 18Questions: 6Answers: 0
function fill_datatable(filter_supplier = '', filter_category = '')
{
var dataTable = $('#supplier_data').DataTable({
serverSide: true,
ajax:{
url: "{{ route('companycost.index') }}",
data:{filter_supplier:filter_supplier, filter_category:filter_category}
},
columns: [
{
data:'suitemID',
name:'suitemID'
},
{
data:'suName',
name:'suName'
},
{
data:'suitemBrand',
name:'suitemBrand'
},
{
data:'suitemCostExGST', //Want to get the total amount of this column and display it in a new row
name:'suitemCostExGST'
},
{
defaultContent: '<input type="button" class="Edit" value="Edit"/><input type="button" class="Delete" value="Delete"/>'
},
]
});
}
Getting the value of suitemCostExGST from the DB. I want to get the sum of all the value in the column and display it in a new row
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Take a look at the FooterCallback Example.
Kevin
Is there a way to store the value of that and pass it to a different page?
E.g: I want the total value of the variable suitemCostExGST and use it in another datatable