footerCallback does not compute sum for a fixedColumn when filter is applied
footerCallback does not compute sum for a fixedColumn when filter is applied
Hello!
I would like to compute a column's sum (Salary, in this case) which is (1) also a fixedColumn and (2) subject to any applied filtering. In this example, I've commented the fixedColumn options out demonstrating that the filtered salaries' sum is computed as expected. However, when the fixedColumn options are applied (Name and Salary columns, in this case) the footerCallback sum reflects the total of all salaries regardless of filtering.
Any advice or thoughts on alternative approaches are appreciated!
This question has an accepted answers - jump to answer
Answers
Hi @mj0seph ,
You can call
fixedColumns().update()
whenever the table is drawn, see here - this ensures the fixedColumns' layer gets updated with the new information.I had expected that I could do this in the
footerCallback
, but for some reason that's causing an error. I've raised it internally (DD-1180 for my reference) and we'll report back here when there's an update.For the meantime, the
draw
should do the trick as shown above.Cheers,
Colin
Thanks, @colin ! That worked perfectly. I appreciate your quick and helpful response.
Ok how did you make that work? Is there a bug when the fixed column is not the only one? I have this:
"fixedColumns": {
"leftColumns": "7",
},
And sums are requred for columns after 5 and it does not update on draw. Can you tell me how to fix it?
@martoo please see my answer in your other thread.
Kevin