ClientGroupFooterTemplate question

3 posts, 0 answers
  1. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 10 Aug 2015 Link to this post

    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. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 12 Aug 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Alan Mosley
    Alan Mosley avatar
    200 posts
    Member since:
    Apr 2010

    Posted 12 Aug 2015 in reply to Rosen Link to this post

    Thanks Rosen
    Good to see.
Back to Top