Add a summary row to the grid with a space between grid and row

1 Answer 1336 Views
Grid
Amol
Top achievements
Rank 1
Amol asked on 16 Dec 2013, 11:36 AM
Hello team, we are facing issue where we want to insert a summary row below the grid, that also with the space between the grid and the summary row.

This row will contain
1. Custom text
2. addition resulting value column wise
3. jscript, so that editing the value in upper grid changes in addition of the summary row.

grid is model binded.
Please give your response to acheive this ASAP please.
  

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 18 Dec 2013, 06:54 AM
Hello Amol,

The built-in Grid aggregates match most closely what you need, however, the footer row, which contains them, is not separated by the Grid data rows in the exact way that you have shown. Nevertheless, I recommend you to use it, otherwise you will need to do a lot of manual coding in order to implement aggregates on your own. An alternative approach would be to hide the footer row with CSS and copy its content to another container, which is then appended to the Grid <div>. Apart from being a hack, this approach has drawbacks and I don't recommend it.

Here is the relevant documentation and a demo.

http://demos.kendoui.com/web/grid/aggregates.html

http://docs.kendoui.com/api/framework/datasource#configuration-aggregate

http://docs.kendoui.com/api/web/grid#configuration-columns.footerTemplate

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Jono
Top achievements
Rank 1
commented on 24 Jan 2014, 02:09 AM

While this isn't quite what the forum post is asking, it is related to the answer.

Is there a way to bind aggregates without groups using MVVM, or do we have to dynamically generate the grid with JavaScript? We are creating all of our view models on the server, so it doesn't really make sense to generate them on the fly on the client, when we can simple bind to a collection in the ViewModel.

Groups do work, but they aren't fit for purpose (which is basically creating rows in a balance sheet).

I can use a footerTemplate, but I just can't have a bound template field: e.g. #:sum#

Thoughts?
Dimo
Telerik team
commented on 27 Jan 2014, 09:19 AM

Hello Jono,

I am afraid I did not understand very well what exactly you are trying to do and how is MVVM related. Generally, there is no problem to generate the content of the (client) footer template on the server and set it as template content. There is no need to use groups in order to use aggregates.

column.Bound(...)
   .ClientFooterTemplate( "my aggregate: " + myModel.myAggregate );


Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Jono
Top achievements
Rank 1
commented on 27 Jan 2014, 07:12 PM

Thanks for the response.

The answer I needed was actually here:

http://stackoverflow.com/questions/16172710/kendo-ui-not-able-to-add-footertemplate-to-grid

The answer from OnaBai contained what I needed, which was to use the aggregate as: Field.aggregate (e.g. Value.sum) in the template rather than bind to a 'sum' field.
Tags
Grid
Asked by
Amol
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or