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

KendoGrid - populate column aggregate in separate div element without using loop.

3 Answers 227 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Avish
Top achievements
Rank 1
Avish asked on 11 Jan 2018, 07:34 PM

Hi All , i am aware that KendoGrid provides columns aggregates in the footer template , my requirement is to populate a editable column aggregate/sum into a separate div element present in form . currently i am looping through all the records in the grid where dirty-lag= true and editable column val >0 . Is there is any other way to address this more efficiently like how JQGrid provides .

 

Example of JqGrid - i can get the sum of a column without looping through all the records .

var sum = $(<GRID_NAME>).jqGrid('getCol','<COLUMN_NAME>',false,'sum');

 

 

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 15 Jan 2018, 01:41 PM
Hello, Avish,

The aggregates for a column can be retrieved using the aggregates method of the dataSource:

https://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-aggregates

I made an example demonstrating how to show the value inside a DIV:

http://dojo.telerik.com/ofomo

I hope this is helpful.

Regards,
Stefan
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.
0
Avish
Top achievements
Rank 1
answered on 16 Jan 2018, 11:53 AM

Thanks you very much for the response Stefan.

somehow while updating the column (editable column)  only save event is called not the dataBound event  in my case ?.

i am using below in the end of save event., is this is causing the concern ?

                 data.dataSource.read();

 

0
Stefan
Telerik team
answered on 18 Jan 2018, 06:37 AM
Hello, Avish,

The save method is called when the Grid is with an incell edit mode and an item is saved. This is not causing full re-rendred of the Grid and the dataBound is only called after the Grid is re-rendered. If you would like to save the changes and re-render the Grid in order to fire the dataBound event I can suggest calling the saveChanges method of the Grid or to set the autoSync property of the dataSource to true:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/savechanges

https://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-autoSync

Also, please have in mind that we will appreciate if a separate ticket is submitted when the new question is not directly related to the first one, as this is helping us to determine which scenarios are most commonly used and based on that to improve the documentation in that direction.

Regards,
Stefan
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.
Tags
Grid
Asked by
Avish
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Avish
Top achievements
Rank 1
Share this question
or