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
435
Custom Summary (Sum) based on selected rows via checkboxes
posted

Here is my situation:

I'm using summaries (Sum Operand only) on two columns of my grid. This is working perfectly.

I have checkbox selection of rows enabled on my grid, and would like to show a summary for only those rows selected, below the existing out of the box summaries.

I beleive my declaration is correct in MVC as follows (I will just show AmountDue summary, as AmountToPay will be pretty much the same logic)

summaries.ColumnSetting().ColumnKey("AmountDue")... //etc

// Below - works fine

builder.SummaryOperand()
.DecimalDisplay(2)
.Type(SummaryFunction.Sum)
.Active(true)
.RowDisplayLabel("Total Due");

// Added this below

builder.SummaryOperand()
.DecimalDisplay(2)
.Type(SummaryFunction.Custom)
.Active(true)
.SummaryCalculator("calculateSelectedAmountDue")
.RowDisplayLabel("Total Selected Due:");

So based on documentation I should provide a function that can calculate the sum of all selected rows - for column ("AmountDue")

I'm not certain what the structure of this function should look like,  how do I get the collection of selected rows and sum the AmountDue column? I was thinking of handling it via iggridsummariessummariescalculating but the code will be looking for "calculateSelectedAmountDue"

Parents Reply Children
No Data