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

Summary row disappear after reset model


If i disabled the OnAppear, the summary row is there.
Can you please show me the correct method to reset and reload the data to datagrid, so the summary row won't be disappear?
Thank you in advance.

This is the code for grouping & summary:
 
_dataGrid.GroupColumnDescriptions.Add(new GroupColumnDescription()
{
ColumnName = "EventID"
});

GridSummaryColumn summaryColumn = new GridSummaryColumn();
summaryColumn.Name = "CaptionSummary";
summaryColumn.MappingName = "Money";
summaryColumn.Format = "{Sum:c}";
summaryColumn.SummaryType = Syncfusion.Data.SummaryType.DoubleAggregate;

GridSummaryRow summaryRow = new GridSummaryRow();
summaryRow.Title = "Total: {CaptionSummary}";
summaryRow.ShowSummaryInRow = true;
summaryRow.SummaryColumns.Add(summaryColumn);

_dataGrid.CaptionSummaryRow = summaryRow;



This is my reset binding method(though i don't know if this is the right code for it ):

void Handle_Appearing(object sender, System.EventArgs e)
{
model = new RepActivitiesRepository(_eventId);
_dataGrid.ItemsSource = model.Activities;
}

2 Replies

MR Mohamad Razif Hussin July 12, 2016 01:30 PM UTC

Nevermind, I just use stack layout and add an external custom summary, solved..


VP Vimal Prabhu Manohkaran Syncfusion Team July 12, 2016 07:25 PM UTC

Hi Mohamad,

Thanks for contacting Syncfusion Support.

Regarding your query to show Summary Row when resetting or changing the itemssource of the SfDataGrid, it is by default the behaviour of SfDataGrid where we clear all the collections when changing the itemssource . This is because we cannot be sure that the next itemssource will also contain the same column name that is present in the current GroupColumnDescription collection. Hence grouping and sorting will be removed when changing itemssource. If you want to show the summary for the new data, we suggest you add the column into the GroupColumnDescription collection again when you are changing the itemssource.

Please revert us if you may have any queries

Regards,
Vimal Prabhu

Loader.
Up arrow icon