Calculate sum of page and total question

Calculate sum of page and total question

islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

I want to calculate the total of everything IF NO SEARCH HAS BEEN STARTED. If someone starts typing in search bar, then the sum becomes this of the search, otherwise it stays the sum of everything.

I also want to calculate the sum of the page following this syntax, cuz it's the one I'm using :

Q= api
    .cells( null, 0 )
    .render('sort')
    .reduce( function (a, b) {
        return intVal(a) + intVal(b);
    }, 0 );
$( api.column( 0 ).footer() ).html(Q);

How can I do that please? :)

This question has an accepted answers - jump to answer

Answers

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    In other words, I want to detect if we started searching in the search bar or not.

    (sorry, can't edit post to add more information so I had to write a reply...)

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @islamelshobokshy ,

    This example here does what you want. It also shows the sum of the selected rows too.

    Cheers,

    Colin

This discussion has been closed.