We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Custom summary on Grouped rows

Thread ID:





127108 Oct 26,2016 12:48 PM UTC Oct 28,2016 02:27 PM UTC jQuery 3
Tags: ejGrid
Andrea Perazzolo
Asked On October 26, 2016 12:48 PM UTC

I Have an OData V4 Paged bound grid.
I Group for a column and want to show some totals on the Summary rows of group.
My first problem is that the normal sum is calculated on the grid page data, and if the group is spread across pages I have not the real values on the totals.
I tried with the custom Summary, trying to call an ODATA function to calculate the correct data o the server,, but I don't know how to retrieve, in the custom javascript function the current value of the group where the summary row is calculated.
There is any solution for my problem?

      Thanks in advance

     Andrea Perazzolo

Mani Sankar Durai [Syncfusion]
Replied On October 27, 2016 06:22 AM UTC

Hi Andrea, 
Thanks for contacting Syncfusion support. 
While using ODataV4 adaptors we can get only current page data, so we can’t get aggregates for entire grouped records which are in next page too. Suppose if you want to show aggregate for entire dataSource while using ODataV4Adaptor then we need to send multiple post to server to get the entire data and then send the aggregate through adaptor, so this is not feasible and currently we don’t have support for this by default. Hence we suggest you to use UrlAdaptor instead of ODataV4Adaptor to display the aggregate for whole dataSource. 
Please refer the documentation link of about how to use aggregate in UrlAdaptor. 
Manisankar Durai. 

Andrea Perazzolo
Replied On October 27, 2016 06:36 AM UTC

Thanks for the reply.
I'll ask if there is a way to access the current grouped data in the function that is used to calculate the summary value in the custom summary.
It will be sufficient for me for calling a server function that calculate the whole total for the group.

      Thanks in advance

     Andrea Perazzolo

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On October 28, 2016 02:27 PM UTC

Hi Andrea, 

We cannot achieve your requirement using the Odata service. But we can achieve it using the UrlAdaptor. Refer to the following code example. 

namespace MvcApplication66.Controllers 
    public class HomeController : Controller 
        public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) 
            IEnumerable datasource = new NorthwindDataContext().EmployeeViews.ToList(); 
            DataResult result = new DataResult(); 
            DataOperations operation = new DataOperations(); 
            . . .. . .  
            List<string> str1 = new List<string>(); 
            List<string> str = new List<string>(); 
            if (dm.Aggregates != null) 
                for (var i = 0; i < dm.Aggregates.Count; i++) 
                result.aggregate = operation.PerformSelect(datasource, str); 
            if (dm.Group != null) { 
                for (var i = 0; i < dm.Group.Count; i++) 
                result.groupDs = operation.PerformSelect(DataSource, str1); 
                if (dm.Aggregates != null) 
                    for (var i = 0; i < dm.Aggregates.Count; i++) {  
                    result.groupDs = operation.PerformSelect(DataSource, str1); 
            result.count = count; 
            result.result = datasource; 
            return Json(result, JsonRequestBehavior.AllowGet); 
        public class DataResult 
            public IEnumerable result { get; set; } 
            public int count { get; set; } 
            public IEnumerable aggregate { get; set; } 
            public IEnumerable groupDs { get; set; } 
<div id="Grid"></div> 
<script type="text/javascript"> 
    $(function () { 
            dataSource: ej.DataManager({ 
                url: "/Home/DataSource", 
                adaptor: new ej.UrlAdaptor() 
            summaryRows: [ 
                    { title: "Sum", summaryColumns: [{ summaryType: ej.Grid.SummaryType.Sum, displayColumn: "Freight", dataMember: "Freight", format: "{0:C2}" }] }, 
                                 . .  

The above code example handles the data for Total summary as well as the Group summary of the Grid. 

Seeni Sakthi Kumar S.  


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon