This is a migrated thread and some comments may be shown as answers.

Aggregates totals with multiple levels of grouping

2 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 13 Mar 2014, 02:40 PM
Hi,

I'm having a minor issue with showing aggregate totals when using 2 levels of grouping on a Grid. My grid is grouped by Vendor then invoice and the totals show once for each level of grouping. This is what I want but when there is only one invoice in the group it looks quite confusing (please see attached). Is there a way in the ClientGroupFooterTemplate to check which level of grouping is currently being shown so I can change the labelling accordingly? So something like the below but I don't know how I would calculate the function IAmInvoiceTotal().

.ClientGroupFooterTemplate("# if(IAmAnInvoiceTotal()){#Invoice Total : #= kendo.toString(sum, 'c') #}else{#Vendor Total : #= kendo.toString(sum, 'c') #}");

I can use jquery to check the class of the previous row and work out which level of grouping I'm at and dynamically change the label that way but it seems like there is probably an easier way.


2 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 17 Mar 2014, 02:26 PM
Hello Michael,

I would recommend adding a "count" aggregate as well and the check its value in the template. This will allow you to identify the number of items in a group and show the sum accordingly.

Regards,
Alexander Popov
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Haluk
Top achievements
Rank 1
answered on 18 Mar 2014, 02:13 PM
Please can you help me for this situation 

http://www.telerik.com/forums/telerik-mvc-grid-row-values-failing-after-group-by
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Haluk
Top achievements
Rank 1
Share this question
or