sfDataGrid GridTableSummaryRow and GridSummaryColumn not working

I'm trying to add a summary row/column to my sfDataGrid and it's not working. When I add the row with the appropriate columns, the grid shows a large red X and not the data (definitely not the summary row). However, I do notice that the scrollbars seem to indicate that there is data somewhere. I modeled my code from the Summaries documentation for sfDataGrid. The data is coming from a LINQ query.

OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "TKT_NO", HeaderText = "Ticket", ColumnMemberType = typeof(System.String), Width = 90f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "TKT_DT", HeaderText = "Date", ColumnMemberType = typeof(System.DateTime), Width = 150f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "STR_ID", HeaderText = "Store", ColumnMemberType = typeof(System.String), Width = 65f });
OrdersGridView.Columns.Add(new GridNumericColumn() { MappingName = "TOT", HeaderText = "Total", ColumnMemberType = typeof(System.Decimal), Format = "C2", CellStyle = new CellStyleInfo() { HorizontalAlignment = HorizontalAlignment.Right }, Width = 75f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "REF", HeaderText = "Type", ColumnMemberType = typeof(System.String), Width = 65f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "HasTracking", HeaderText = "Track?", ColumnMemberType = typeof(System.String), Width = 65f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "SHIP_VIA_COD", HeaderText = "Ship", ColumnMemberType = typeof(System.String), Width = 65f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "HAS_RLSD_LINS", HeaderText = "Released", ColumnMemberType = typeof(System.String), Width = 65f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "CUST_PO_NO", HeaderText = "PurchaseOrder", ColumnMemberType = typeof(System.String), Width = 140f });
OrdersGridView.Columns.Add(new GridTextColumn() { MappingName = "HasPayment", HeaderText = "Pmt?", ColumnMemberType = typeof(System.String), Width = 65f });

GridTableSummaryRow tableSummaryRow1 = new GridTableSummaryRow
{
Name = "TableSummary",
ShowSummaryInRow = false,
//Title = "Total: {OrderTotal}",
Position = VerticalPosition.Bottom
};
tableSummaryRow1.SummaryColumns.Add(new GridSummaryColumn()
{
Name = "OrderTotal",
SummaryType = SummaryType.DoubleAggregate,
Format = "{Sum:c}",
MappingName = "Total",
});

OrdersGridView.TableSummaryRows.Add(tableSummaryRow1);



5 Replies

VS Vijayarasan Sivanandham Syncfusion Team May 21, 2020 11:16 AM UTC

Hi Kevin Swanner,

Thank you for contacting Syncfusion support.

We suspect that your mentioned Mapping name as Header text value. Header text only display the Contained text in Column. But Mapping name should be defined as property of data bound object. So, define Mapping Name as TOT in your table summary. Please refer the below code snippet, 
OrdersGridView.Columns.Add(new GridNumericColumn() { MappingName = "TOT", HeaderText = "Total", ColumnMemberType = typeof(System.Decimal), Format = "C2", CellStyle = new CellStyleInfo() { HorizontalAlignment = HorizontalAlignment.Right }, Width = 75f }); 
 
tableSummaryRow1.SummaryColumns.Add(new GridSummaryColumn() 
                { 
                                Name = "OrderTotal", 
                                SummaryType = SummaryType.DoubleAggregate, 
                                Format = "{Sum:c}", 
                                MappingName = "TOT", 
                }); 
 



RC Roger Criebaum May 21, 2020 01:02 PM UTC

Thank you for pointing that out. That was actually a typo--I was trying different things and inadvertently left that in. It was originally TOT. I changed it back and it's still doing the same thing.


VS Vijayarasan Sivanandham Syncfusion Team May 22, 2020 06:27 PM UTC

Hi Kevin Swanner,

Thanks for the update.

We have checked the reported issue and unable to replicate the issue from our end. Please find the tested sample and video demo from our end in the below link,

Sample Link: https://www.syncfusion.com/downloads/support/forum/154455/ze/Sample-2138042795

Video Link:
https://www.syncfusion.com/downloads/support/forum/154455/ze/TableSummary-1385897700
 

Can you please share us below things?
       
        1. Brief replication procedure/video illustration of the reported issue
 
         
if you still facing the same issue? If yes, please modify the sample based on your scenario. 

Regards,
Vijayarasan S
 



RC Roger Criebaum May 29, 2020 03:22 PM UTC

Thanks for the info.

I figured out what I was doing wrong. I had a QueryRowStyle even defined. In the event, I was processing row data (if it exists) for all rows...including the summary row. When I process the row data for only RowType.DefaultRow, then it works.

Thanks for your help!

Kevin


SS Susmitha Sundar Syncfusion Team June 1, 2020 08:10 AM UTC

Hi Kevin, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this.  
 
Regards, 
Susmitha S 


Loader.
Up arrow icon