Hi,
I am using a grid with groupby to display data. I have search both this forum and on the net for a solution but have not found anything that makes me able to accomplice what I am after.
My grid have a number of columns and grouping in multiple levels works as intended. One column has the field of "Amount", which is 1 or more for each data row. Using the summary functions, I can easily get the sum of "Amounts" for each group of rows.
groupedRowTextTemplate defines the text for the grouped row header and I want to alter this to include the sum value of the "Amount" column. This would allow me to show the most important information with the grouped rows collapsed.
I guess I need some jquery/JavaScript in order to make this work, but I am not sure how to do this.
I am working in MVC using the wrapper to create my grid.
/ FW
With the help from Martin Kamenov, I have found a way to achieve what I wanted. The trick was to add the summarysettings part and Summaries to the "Amount" column.
features.GroupBy()
.SummarySettings(new GroupBySummarySettings() { SummaryFormat = "#0" })
.GroupSummariesPosition(GroupSummariesPositionMode.Top)
.InitialExpand(false)
.ColumnSettings(groupedcolumn =>
{
groupedcolumn.ColumnSetting().ColumnKey("ID").IsGroupBy(true);
groupedcolumn.ColumnSetting().ColumnKey("Amount").Summaries(s =>
s.Summary().Text("total: ").SummaryFunction(SummaryFunction.Sum);
}).GroupSummaries(gs =>
gs.GroupSummary().SummaryFunction(SummaryFunction.Count);
gs.GroupSummary().SummaryFunction(SummaryFunction.Sum);
});
This adds "Amount total: n" to the grouped row text, which makes the total amount visible even when the grouped row is collapsed.
It seems to work as intended, so thanks for the help!
Hello Fredrik,I am glad that you found my suggestion helpful.Thank you for using Infragistics components.