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

Grid w/ Sum at Footer

2 Answers 271 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Deamon
Top achievements
Rank 2
Deamon asked on 12 Feb 2015, 08:12 PM
How would one go about changing the demo at ...

http://demos.telerik.com/aspnet-mvc/grid/editing

to incorporate a footer that includes the total sum (or sum of shown items, whichever is easier) of the price field?  I was able to use Aggregates and ClientFooterTemplate to get a sum to show, but I want it to update as you lose focus of the control that contains values that affect the sum.  

So for example, when you delete a record the sum should reflect the change.  If you add a new record, enter a value and exit the control the value should change.  Also, if you edit the value of an existing price and exit the control (lose focus) the sum at the bottom should update.

Also, I'd like access to the sum in the footer client side (via jQuery?) for other actions. 

Any pointers?

G

2 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 16 Feb 2015, 12:58 PM

Hello Deamon,

I would suggest you to turn on the autoSync() option of the dataSource, so data is automatically saved when changed and therefore the aggregates are relculated. It should be like this:

.DataSource(dataSource => dataSource       
        .AutoSync(true)

As for accessing the aggregates values = you can do it with JavaScript like this:

$("#Grid").getKendoGrid().dataSource.aggregates() //where "Grid" is your Kendo UI Grid Id

Regards,
Kiril Nikolov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Deamon
Top achievements
Rank 2
answered on 16 Feb 2015, 01:30 PM
Perfect, thanks for the info.
Tags
Grid
Asked by
Deamon
Top achievements
Rank 2
Answers by
Kiril Nikolov
Telerik team
Deamon
Top achievements
Rank 2
Share this question
or