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.
Unfortunately, activation email could not send to your email. Please try again.

No summary when using URLAdapter

Thread ID:

Created:

Updated:

Platform:

Replies:

128393 Jan 18,2017 02:15 PM Jan 23,2017 11:42 PM ASP.NET MVC 3
loading
Tags: Grid
Michael Lambert
Asked On January 18, 2017 02:15 PM

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


Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On January 19, 2017 08:19 AM

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. 


Michael Lambert
Replied On January 23, 2017 12:54 PM

Worked!  Thanks!!

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On January 23, 2017 11:42 PM

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. 


CONFIRMATION

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.

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.

;