Compute column Total amount in a new row using dataset
Compute column Total amount in a new row using dataset
Compute column amount in a new row using dataset
My data is from a dataset and not api, is it possible for me to compute a column sub total
E.g if my data set is something like this
$data .= "['" . $t_date . "','" . $t_description . "','" . $t_amount . "','" . $t_rebate . "','" . $t_net . "','" . $t_returns. "','" . $t_balance . "'],";
I want to compute the total of $t_balance , and append it in a new row below the data table such as, t_balance have value like -100.50, 500.20 , all the doubles with - for negative value, but I not using api so I not sure if I can use fallback function, if I am using dataset, is it possible to get the same result as api, and append the total of my t_balance in a new row on change of page or number of records from 10 to 50 etc.
var subtotal;
//add row
table.row.add( [
"",
"",
"",
"",
"",
"",
"",
'subtotal'
] ).draw();
This question has an accepted answers - jump to answer
Answers
You can get all the data for a column by:
You could hook this calculation into a preDrawCallback or footerCallback and create/update your total row.