Footer sum based on a more complex situation (another columns, value signs, ...)
Footer sum based on a more complex situation (another columns, value signs, ...)
itajackass
Posts: 162Questions: 48Answers: 3
My goal is to do a more complex sum based on another column:
Details:
This is the flow i'd like to do:
- var $SUM = 0;
- If column Type == IN then:
2.1 IF AMOUNT > 0 THEN $sum = $sum + AMOUNT; ELSE $sum = $sum - AMOUNT;
3 If column Type == OUT then:
3.1 IF AMOUNT > 0 THEN $sum = $sum - AMOUNT; ELSE $sum = $sum + AMOUNT;
So this is i'm expecting:
$sum = 0;
$sum = $sum + 200;
$sum = $sum + 100;
$sum = $sum - 50;
$sum = $sum -10;
//$sum now is: 240 (i'd like to have this result) instead 340.
This is my example fiddle: http://live.datatables.net/togejizi/1/edit
If it possible i'd like to use data-in attribute i've inserted for each cell.
This discussion has been closed.
Replies
I've tried this working solution.
http://live.datatables.net/liravimi/1/edit
But i'll ask for a better solution if is possible?