How to use sum.js to sum column values after column().search is applied.
How to use sum.js to sum column values after column().search is applied.
I found the link to sum.js. While I found it is correctly giving me the sum of all records in a desired column, I am unable to get the sum of only selected records when applying a column search like this. I do not see this scenario in the code examples. What can I do to achieve the desired outcome?
// Initially, the summary table has a total of 957.
// **
// This search command returns the correct set of records
summaryTable.column(1).search(`^${selectedCampusFilter}$`,true).draw;
// This always returns 957 instead of the correct value after applying the search -- 12.
const counts = summaryTable.column(4).data().sum();
console.log(counts);
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
See if the
selector-modifer
of thecolumn()
API helps. Probably something like this:Kevin