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. Image for the cookie policy date

No summary when using URLAdapter

I also get 0 from summary. Some fields in the DB may contain a NULL values and it in INT type.

@(Html.EJ().Grid<Request>("OneCloudGrid")
                            .Datasource(ds => ds.URL(@Url.Action("GetData", "OneCloud")).UpdateURL(@Url.Action("Update", "OneCloud")).Adaptor(AdaptorType.UrlAdaptor))

..........

        .ShowSummary()
        .SummaryRow(row =>
        {
            row.Title("Totals").SummaryColumns(col => { col.SummaryType(SummaryType.Sum).Format("{0:N}").DisplayColumn("Storage").DataMember("Storage").Add(); }).Add();
        })

  
Thanks,Mike


3 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team January 19, 2017 01:19 PM UTC

Hi Michael, 
 
We suspect that your URL method is missing the server-side operation for the summary rows. When using UrlAdaptor, you have to handle all the Grid actions in the server-end. Likewise, the SummaryRows also falls to the same category.  
 
In the server-end, you have to select he required aggregate columns and return the same to the client-end. Refer to the following code example. 
 
 
@(Html.EJ().Grid<object>("Grid") 
        .Datasource(ds => 
            ds.URL("/Home/DataSource") 
                .Adaptor(AdaptorType.UrlAdaptor)) 
        .AllowPaging() 
        .ShowSummary() 
        .SummaryRow(row => 
        { 
            row.Title("Totals") 
                .SummaryColumns(col => {  
                    col.SummaryType(SummaryType.Sum) 
                        .Format("{0:N}") 
                        .DisplayColumn("Freight") 
                        .DataMember("Freight").Add();  
                }).Add(); 
        }) 
                 . . . 
) 
 
        public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) 
        { 
 
            IEnumerable datasource = new NorthwindDataContext().OrdersViews.ToList(); 
            DataResult result = new DataResult(); 
            DataOperations operation = new DataOperations(); 
            List<string> str = new List<string>(); 
            if (dm.Aggregates != null) 
            { 
                for (var i = 0; i < dm.Aggregates.Count; i++) 
                    str.Add(dm.Aggregates[i].Field); 
                result.aggregate = operation.PerformSelect(datasource, str); 
            } 
            int count = datasource.AsQueryable().Count(); 
                 . .  
                    . . . 
            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; } 
        } 
 
We have also prepared a sample that can be downloaded from the following location. 
 
 
Refer to the following Help Document. 
 
 
Regards, 
Seeni Sakthi Kumar S. 



ML Michael Lambert January 23, 2017 05:54 PM UTC

Worked!  Thanks!!


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team January 24, 2017 04:42 AM UTC

Hi Michael,  
 
We are happy to hear that your requirement has been achieved. Please get back to us, if you require further assistance on this. 
 
Regards, 
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon