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

ClientGroupFooterTemplate question

2 Answers 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alan Mosley
Top achievements
Rank 1
Alan Mosley asked on 10 Aug 2015, 03:55 PM

I want to divide one aggregate by another.

Take these aggregates

Aggregates(Sub(aggregates)
                           aggregates.Add(Function(p) p.Total).Min().Max.Count()
                           aggregates.Add(Function(p) p.Total).Average()
                           aggregates.Add(Function(p) p.Total).Sum()
                           aggregates.Add(Function(p) p.Enrolments).Average()
                           aggregates.Add(Function(p) p.Enrolments).Sum()
                           aggregates.Add(Function(p) p.StudentEvents).Average()
                           aggregates.Add(Function(p) p.StudentEvents).Sum()
                           aggregates.Add(Function(p) p.Products).Average()
                           aggregates.Add(Function(p) p.Products).Sum()
                           aggregates.Add(Function(p) p.Male).Sum()
                           aggregates.Add(Function(p) p.Female).Sum()
                           aggregates.Add(Function(p) p.Students).Sum()
                   End Sub).

I want to do something like this below, note "sum / Students " where sum is the sum of enrolments and students is the sum of students, is this possible? thanks

 

columns.Bound(Function(p) p.Enrolments).Format("{0:C}").
                        ClientFooterTemplate("Avg #= kendo.toString(sum / Students ,'C')#<br />Total #= kendo.toString(sum ,'C')#").
                        ClientGroupFooterTemplate("<div>Avg #= kendo.toString(sum / Students ,'C')#</div><div>Total #= kendo.toString(sum ,'C')#</div>")

 

 
 
 

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 12 Aug 2015, 08:27 AM

Hello Alan,

Indeed, you can access the values of other column aggregates inside the ClientFooterTemplate/GroupFooterTemplate. It can be done via similar to the following syntax:

ClientFooterTemplate("Avg #= kendo.toString(data.Enrolments.sum/ data.Students.count,'C')#<br />Total #= kendo.toString(sum ,'C')#")

Regards,
Rosen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Alan Mosley
Top achievements
Rank 1
answered on 12 Aug 2015, 12:29 PM
Thanks Rosen
Good to see.
Tags
Grid
Asked by
Alan Mosley
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Alan Mosley
Top achievements
Rank 1
Share this question
or