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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

My summaryRows is always empty (zero)

Thread ID:





120254 Sep 14,2015 10:16 PM UTC Sep 21,2015 06:09 AM UTC JavaScript 3
Tags: ejGrid
Cristiano Souza Silva
Asked On September 14, 2015 10:16 PM UTC

I don't know why, the main summary on ejGrid is always empty.

<div id="Grid" data-bind="ejGrid: {
     dataSource: dataSource,
     summaryRows: summaryRows,
     showSummary: true,
     allowGrouping: true,
     allowPaging: false,
     pageSettings: { pageSize: 5 },                     
     locale: 'pt-BR',
    groupSettings: { showUngroupButton: false, groupedColumns: ['TypeName'] },
    columns: column,
     toolbarSettings: {
        showToolbar: false,
        toolbarItems: [ej.Grid.ToolBarItems.PrintGrid, ej.Grid.ToolBarItems.ExcelExport]

<script type="text/javascript">
        $(function () {

            window.baseView = {
                dataSource: ej.DataManager({ url: '@Url.Action("KODataSource")', adaptor: "UrlAdaptor" }),
                column: [
                          { field: "TypeName", isPrimaryKey: true, headerText: "Tipo" },
                          { field: "CategoryName", headerText: "Categoria" },
                          { field: "Price", headerText: "Valor (R$)", format: "{0:n}", textAlign: ej.TextAlign.Right }
                summaryRows: [
                              showCaptionSummary: true,
                              title: "Total",
                              summaryColumns: [{
                                  summaryType: ej.Grid.SummaryType.Sum,
                                  displayColumn: "Price",
                                  dataMember: "Price",
                                  format: "{0:n}"




        public ActionResult KODataSource(DataManager clsDataManager)
            DateTime dteInitialDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime dteEndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));

            if (clsDataManager.Where != null && clsDataManager.Where.Count > 0)
                WhereFilter whereInitialDate = clsDataManager.Where.Where(item => item.Field == "InitialDate").FirstOrDefault();
                WhereFilter whereEndDate = clsDataManager.Where.Where(item => item.Field == "EndDate").FirstOrDefault();

                if (whereInitialDate != null && whereEndDate != null &&
                    whereInitialDate.value != null && whereEndDate.value != null)
                    dteInitialDate = DateTime.Parse(whereInitialDate.value.ToString());
                    dteEndDate = DateTime.Parse(whereEndDate.value.ToString());

            List<Bill> clsBills = BillBusiness.GetAllFilterReports(dteInitialDate, dteEndDate).ToList();

            CashFlowModel clsModel = new CashFlowModel()
                Items = Mapper.Map<List<Bill>, List<CashFlowItemModel>>(clsBills)

            BaseResult<CashFlowItemModel> clsData = new BaseResult<CashFlowItemModel>();
            clsData.Result = clsModel.Items.GroupBy(item => new { item.CategoryName, item.TypeName })
                                        .Select(item =>
                                        new CashFlowItemModel()
                                            CategoryName = item.Key.CategoryName,
                                            TypeName = item.Key.TypeName,
                                            Price = item.Sum(sum => sum.Price)

            ResultModel result = new ResultModel();

            result.result = clsData.Result;
            result.count = clsData.Result.Count();

            return Json(result, "application/json", Encoding.Default, JsonRequestBehavior.AllowGet);

1 - Can you help me with this problem ?

2 - Another question, Can I get my Data that binding on ejGrid? Maybe I use in other places.

Thank you.

Attachment: problem_a0e1041a.zip

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On September 15, 2015 09:02 AM UTC

Hi Cristiano,

Thanks for contacting Syncfusion Support.

Query1: the main summary on ejGrid is always empty.

Summary Rows has not been handled in the server-side in the given code example. While using remote data, Summary Row must be handled by returning summary column and their respective datasource into the aggregate key, as shown in the below example.


<div id="Grid" data-bind="ejGrid: {dataSource: dataSource, columns: col,showSummary: true,allowGrouping:true,summaryRows:summaryRows}"></div>

<script src="~/Scripts/jsondata.min.js"></script>

<script type="text/javascript">

        $(function () {

            window.orderView = {

                dataSource: ej.DataManager({ url: '/Grid/DataSource', adaptor: "UrlAdaptor" }),

                col: [{ field: 'OrderID', headertext: 'Order ID', width: '75', textalign: ej.TextAlign.Right },

           . . .


                summaryRows: [{ title: "Sum", summaryColumns: [{ summaryType: ej.Grid.SummaryType.Sum, displayColumn: "Freight", dataMember: "Freight", format: "{0:C2}" }],

                    showTotalSummary: true







public partial class GridController: Controller


        . . .

       public ActionResult DataSource(DataManager dm)


            IEnumerable DataSource = OrderRepository.GetAllRecords();

            DataOperations ds = new DataOperations();

            DataResult result = new DataResult();

            List<string> str = new List<string>();

            if (dm.Aggregates != null)


                for (var i = 0; i < dm.Aggregates.Count; i++)


                result.aggregate = ds.PerformSelect(DataSource, str);


           DataSource = ds.PerformSkip(DataSource, dm.Skip);

            result.result = ds.PerformTake(DataSource, dm.Take);

            result.count = DataSource.AsQueryable().Count();

            return Json(result, JsonRequestBehavior.AllowGet);


      . . .

Please refer following sample and output


Query2:  Can I get my Data that binding on ejGrid?

Create a Grid instance and retrieve the DataSource instance via model of Grid. We can use currentViewData from model, to retrieve the data bound currently(CurrentPage’s data) to the grid.

var obj = $("#Grid").ejGrid("instance")

obj.model.dataSource; // instance of dataManager

obj.model.currentViewData; //retreives the currentPage's data alone

Seeni Sakthi Kumar S.

Cristiano Souza Silva
Replied On September 18, 2015 07:24 PM UTC

Works for me.

Thank you.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On September 21, 2015 06:09 AM UTC

Hi Cristiano,

Thanks for the update.

We are glad to know that our solution helped you achieve your requirement. Please get back to us if you need any further assistance.

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