using sum in row cell

2 posts, 0 answers
  1. Boschi
    Boschi avatar
    10 posts
    Member since:
    Apr 2010

    Posted 06 Oct Link to this post

    Hi, I've got a grid containing a list of elements with a corresponding numeric value, where I use the aggregate functions to show the sum in the footer. Something like this:

    ELEMENTS  |  VALUE

    element1       |      1

    element2       |      2

    element3       |      3

    ---------------------------------

    TOTAL           |      6

     

    now I need to show beside the row number the percentual relative to the total, this way:

    ELEMENTS  |  VALUE
    element1       |      1 (16.67%)
    element2       |      2 (33.33%)
    element3       |      3 (50.00%)
    ---------------------------------
    TOTAL           |      6

    so I add to the VALUE column options this:

    template: "#:value#<br>#=100*value/sum#%"

    but the grid stops working, without even showing errors in the console. What am I missing?

  2. Georgi
    Admin
    Georgi avatar
    156 posts

    Posted 10 Oct Link to this post

    Hi Boschi,

    Possible solution is to pass a function to the column.template property. Then access the aggregates using aggregates method and create the template:



    Regards,
    Georgi
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top