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.

Grid Summary And Remote Data

Thread ID:

Created:

Updated:

Platform:

Replies:

119447 Jun 22,2015 07:51 PM Jun 24,2015 08:36 AM ASP.NET MVC 3
loading
Tags: Grid
Ümüt Karakoç
Asked On June 22, 2015 07:51 PM

How can I show my grid summary when I working with remote data(wep api) ?

my current wep api code is like that
            var accounts =
                from acc in db.Accounts
                where acc.Deleted == false
                orderby acc.Name
                select new
                {
                    Id = acc.Id,
                    Code = acc.Code,
                    Name = acc.Name,
                    IdentityCode = acc.IdentityNo,
                    Group = acc.Group.Name,
                    Branch = acc.Branch.Name,
                    Active = acc.Active,
                    DefaultPhone = acc.PhoneNumbers.Select(x => x.Name).FirstOrDefault(),
                    Balance = //bla bla bla
                };
             // I can return count and result. but how can I return Balance Total Summary?
            var result = new
            {
                result = accounts.Skip(dm.Skip).Take(dm.Take),
                count = accounts.Count(),
            };
            return Json(result, JsonRequestBehavior.AllowGet);

Ajith R [Syncfusion]
Replied On June 23, 2015 04:51 AM

Hi Ümüt,

Thanks for using Syncfusion products.

Query: How can I show my grid summary when I working with remote data(wep api) ?

We suggest you to use WebApiAdaptor and enable ShowSummay with adding the SummaryRows and SummaryColumns in the Grid properties to achieve your requirement. Please refer the below code snippet for further details.


@(Html.EJ().Grid<Orders>("WebApiGrid")

    .Datasource(ds => ds.URL("/api/Orders").Adaptor(AdaptorType.WebApiAdaptor))

    .AllowPaging()

    .ShowSummary()

    .SummaryRow(row =>

    {

        row.Title("Sum").SummaryColumns(col => { col.SummaryType(SummaryType.Sum).Format("{0:C}").DisplayColumn("Freight").DataMember("Freight").Add(); }).Add();

        ------------

        ------------

   })

    -------------

    -------------
)


Note: We have analyzed your code snippet and found that you have used UrlAdaptor functionalities in your controller. For your kind information when we use Web API controller it will perform the data functionalities itself and we don’t need to perform custom operations to return the result.

Please refer the below UG Doc and Online Demo link to know further details about Summary functionality in ejGrid.

UG Doc: http://help.syncfusion.com/ug/js/index.html#!Documents/summary1.htm

Online Demo: http://mvc.syncfusion.com/demos/web/grid/summary

For your convenience we have created a simple sample and the same can be downloaded from the below link.

Sample Link: http://www.syncfusion.com/downloads/support/forum/119447/ze/WebApiGrid1204689187

Please let us know if you have any concerns.

Regards,
Ajith R

Ümüt Karakoç
Replied On June 23, 2015 05:28 AM

thank you. it is why I recommened syncfusion to every body :)

Ajith R [Syncfusion]
Replied On June 24, 2015 08:36 AM

Hi Ümüt,

Thanks for your update.

We are happy to hear that your requirement has been achieved in your end.

Please get back to us if you have any other concerns.

Regards,
Ajith R

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.

;