Grid w/ Sum at Footer

3 posts, 0 answers
  1. Deamon
    Deamon avatar
    8 posts
    Member since:
    Nov 2012

    Posted 12 Feb 2015 Link to this post

    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. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 16 Feb 2015 Link to this post

    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.

     
  3. Deamon
    Deamon avatar
    8 posts
    Member since:
    Nov 2012

    Posted 16 Feb 2015 in reply to Kiril Nikolov Link to this post

    Perfect, thanks for the info.
Back to Top