Childgrid summary

Hi,

I am using the Hierarchical grid and I want to use Summary for 2 columns in my child grid, but it is not working...

Really appreciate the support,

Thanks,
Laura

4 Replies

LJ Laura Jordan replied to Laura Jordan July 4, 2018 05:44 PM UTC

Hi,

I am using the Hierarchical grid and I want to use Summary for 2 columns in my child grid, but it is not working...

Really appreciate the support,

Thanks,
Laura

Hi,

I want to obtain the summary for the columns in the most internal grid, but it is not working...



Appreciate the support,
Thanks


MP Manivannan Padmanaban Syncfusion Team July 5, 2018 12:08 PM UTC

Hi Laura, 
 
Thanks for contacting syncfusion support. We are happy to assist you. 

Query: I am using the Hierarchical grid and I want to use Summary for 2 columns in my child grid, but it is not working... 
 
We are unable to reproduce the reported issue at our end. Please refer the below code example, 


@(Html.EJ().Grid<object>("FlatGrid") 
                   …………. 
                .Columns(col => 
                { 
                 …………….. 
                }) 
                         .ChildGrid(child => 
                         { 
                             ………….. 
                               .ShowSummary()  // enable the showsummary property in child grid. 
                                 .SummaryRow(row => 
                                 { 
                                     row.Title("Totals").SummaryColumns(col => 
                                     { 
                                         col.SummaryType(SummaryType.Sum).Format("{0:C}").DisplayColumn("Freight").DataMember("Freight").Add(); 
                                         col.SummaryType(SummaryType.Sum).Format("{0:C}").DisplayColumn("OrderID").DataMember("OrderID").Add(); 
 
                                     }).Add(); 
                                 }) 
                                 
                                .Columns(col => 
                                { 
                                    ………….. 
                                    col.Field("Freight").Width(120).Format("{0:C2}").Add(); 
                                    col.Field("OrderID").HeaderText("OrderID"). 
Format("{0:C2}").TextAlign(TextAlign.Right).Width(75).Add(); 
                                    …………………… 
                                }); 
                         }) 
 
    ) 
</div> 



For your convenience we have created the sample refer the below link, 

Output

 

If you are using remote data then, it must to handle the summary row in server-side. Please refer the below help documentation link, 

After referring the above details, still facing the issue then please get back to us with the following details. 

  1. Share the complete grid code example(both view and controller page).
  2. Share the data source details like local (or) remote data.

Provided details, will help us to resolve the reported issue as early as possible. 

Regards, 

Manivannan Padmanaban. 



LJ Laura Jordan replied to Manivannan Padmanaban July 5, 2018 03:43 PM UTC

Hi Laura, 
 
Thanks for contacting syncfusion support. We are happy to assist you. 

Query: I am using the Hierarchical grid and I want to use Summary for 2 columns in my child grid, but it is not working... 
 
We are unable to reproduce the reported issue at our end. Please refer the below code example, 


@(Html.EJ().Grid<object>("FlatGrid") 
                   …………. 
                .Columns(col => 
                { 
                 …………….. 
                }) 
                         .ChildGrid(child => 
                         { 
                             ………….. 
                               .ShowSummary()  // enable the showsummary property in child grid. 
                                 .SummaryRow(row => 
                                 { 
                                     row.Title("Totals").SummaryColumns(col => 
                                     { 
                                         col.SummaryType(SummaryType.Sum).Format("{0:C}").DisplayColumn("Freight").DataMember("Freight").Add(); 
                                         col.SummaryType(SummaryType.Sum).Format("{0:C}").DisplayColumn("OrderID").DataMember("OrderID").Add(); 
 
                                     }).Add(); 
                                 }) 
                                 
                                .Columns(col => 
                                { 
                                    ………….. 
                                    col.Field("Freight").Width(120).Format("{0:C2}").Add(); 
                                    col.Field("OrderID").HeaderText("OrderID"). 
Format("{0:C2}").TextAlign(TextAlign.Right).Width(75).Add(); 
                                    …………………… 
                                }); 
                         }) 
 
    ) 
</div> 



For your convenience we have created the sample refer the below link, 

Output

 

If you are using remote data then, it must to handle the summary row in server-side. Please refer the below help documentation link, 

After referring the above details, still facing the issue then please get back to us with the following details. 

  1. Share the complete grid code example(both view and controller page).
  2. Share the data source details like local (or) remote data.

Provided details, will help us to resolve the reported issue as early as possible. 

Regards, 

Manivannan Padmanaban. 


Hi Manivannan,

Thanks for the update, but unfortunally still not working for me :-(

I attach my view and controller code, hoping it helps.

Best regards,
Laura

Attachment: code_81f81b5c.rar


TS Thavasianand Sankaranarayanan Syncfusion Team July 6, 2018 12:34 PM UTC

Hi Laura, 

We have analyzed your query and found that you want to perform summary for the grid while using URLAdaptor. To show the summary for the columns in grid while using URLAdaptor we have to perform Aggregates in server side. But in your given code example you have not handling any Aggregates in your server end. This is the root cause of your issue. 
 
So, we suggest you to add the below code example in your sample. 
 
 
public ActionResult DataSource2(DataManager ds) 
        { 
            IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); 
            DataResult result = new DataResult(); 
            DataOperations operation = new DataOperations(); 
            result.result = DataSource; 
 
            // need to add this line for handling server side aggregates 
            List<string> str = new List<string>(); 
            if (ds.Aggregates != null) 
            { 
                for (var i = 0; i < ds.Aggregates.Count; i++) 
                    str.Add(ds.Aggregates[i].Field); 
                result.aggregate = operation.PerformSelect(DataSource, str); 
            } 
 
            result.count = result.result.AsQueryable().Count(); 
            if (ds.Skip > 0) 
                result.result = operation.PerformSkip(result.result, ds.Skip); 
            if (ds.Take > 0) 
                result.result = operation.PerformTake(result.result, ds.Take); 
            return Json(result, JsonRequestBehavior.AllowGet); 
        } 
 
public class DataResult 
        { 
            public IEnumerable result { get; set; } 
            public int count { get; set; } 
            public IEnumerable aggregate { get; set; } 
            public IEnumerable groupDs { get; set; } 
        } 
 
  
We have prepared a sample and it can be downloadable from the below location. 
 

Refer the help documentation. 



Regards, 
Thavasianand S. 


Loader.
Up arrow icon