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

Weighted average of a column in the group by on kendo grid.

1 Answer 297 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 11 Sep 2012, 05:10 PM
I have columns a and column b in our grid,   and instead of average of b, I want SUM(A*B)/Sum(B) to show up in the group by aggregate to give me the weigthed average.

Is there a way to do this with Kendo UI Grid.  Please give an example if you have done this before.

Thanks

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 14 Sep 2012, 02:30 PM
Hi Kevin,

I am afraid that what you would like to achieve is not supported out of the box. As a workaround you can define a custom function that performs the calculation in the groupFooterTemplate. As an example:
{ field: "A", title: "A", groupFooterTemplate: "#= calculateResult() #" }

To get the field values I recommend using the current state of the grouped DataSource that can be retrieved with the view method.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or