Total column sum where left column have 1

Total column sum where left column have 1

aagrlp640aagrlp640 Posts: 3Questions: 1Answers: 0

Hi, i have a table and everything is working fine, but i need to sum the columns only that left column have 1
This is my code by the moment:
total = api
.column(5)
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
pageTotal = api
.column(5, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column(5).footer() ).html(pageTotal +' ( '+ total +' total)');

How can i make this:

id | active | value
1 | 1 | 100
2 | 0 | 50
3 | 1 | 200
Total: 300

Replies

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.