Column Totals in multiple rowGroups
Column Totals in multiple rowGroups
I'm looking to add a sum to a rowGroup. (similar to rows.count()) - I have found A LOT of threads covering this, but everythig I try doesn't seem to work.
I keep coming away with NaN. From my research I gather that it's not recognizing my column (17) as an integer. The data is an integer and the column type is defined as "num".
Here's my fiddle;
https://jsfiddle.net/thegamechangerpro/9b5kwfpx/29/
I believe my problem area starts at line 344
the append for the variable total is in line 376
The only 2 records that have data in them for column(17) are in lines 186 and 187
I've added the sum() plug-in, would that be a better route to go rows.column(17).data().sum() ? (Couldn't get that to work either).
Replies
Put
console.log(a, b)
in the reduce function and you will see thatb
isundefined
.https://jsfiddle.net/cy4bmurn/
I believe this is due to using
.pluck(17)
which is used for arrays. You are using objects so you need to use.pluck('myObject')
. See thepluck()
docs for details.Kevin
You're right as always.
Thanks!