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

Grid Summary And Remote Data

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);

3 Replies

AR Ajith R Syncfusion Team June 23, 2015 08:51 AM UTC

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


ÜK Ümüt Karakoç June 23, 2015 09:28 AM UTC

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


AR Ajith R Syncfusion Team June 24, 2015 12:36 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon