Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2745
igGridSummaries Calculate value based on row context
posted

I need to calculate a rollup of dollars where we show parent/child in a grid.  When we calculate a summary, we cannot SUM the children again because that'll duplicate the values.

How do I get the context of the rows that are being summed so I know whether or not to include that value?  I need to sum all parents and exclude all children.

https://www.igniteui.com/help/api/2021.1/ui.iggridsummaries#options:columnSettings.summaryOperands.summaryCalculator

The current method only provides the values of all records.  Even if I grab the datasource of the grid, the method doesn't provide the current column its calculating.

Looking at the attachment:

1.  Expanded grid contains parent and child records.  The data itself has flags indicating whether its a parent or child.

2.  The summary total sums up the columns correctly when its collapsed.  (Shaded GREEN)

3.  The summary totals duplicates that parent's children when its expanded.  (Shaded RED)

How do I have the context of the record in the summaries so I can correctly sum up the values?  I tried hooking into the summariesCalculated method but I do not see a clean way to retrieve the HTML object to replace the value.  How can I cleanly get this?

Thanks,