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

4 posts, 0 answers
  1. Avish
    Avish avatar
    7 posts
    Member since:
    Jan 2018

    Posted 11 Jan 2018 Link to this post

    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');

     

     

  2. Stefan
    Admin
    Stefan avatar
    2491 posts

    Posted 15 Jan 2018 Link to this post

    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.
  3. Avish
    Avish avatar
    7 posts
    Member since:
    Jan 2018

    Posted 16 Jan 2018 in reply to Stefan Link to this post

    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();

     

  4. Stefan
    Admin
    Stefan avatar
    2491 posts

    Posted 18 Jan 2018 Link to this post

    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.
Back to Top