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
close icon

Sorting of Average data shown in Summary In Caption

Hi,

In your examples for "Summary In Caption" for GridGroupingControl (http://www2.syncfusion.com/syncfusion2_0/Web/Grid.Grouping.Web/samples/2.0/Summaries/SummaryInCaption/cs/SummaryInCaption.aspx), how can I sort descending order only for the Average Freight values for a given group?

What I would like to see is Ship via grouping is closed and the average Frieght values are sorted in descending order. I donot want the individual values inside a group be sorted.

Please provide a sample.

Thanks,

Rekha



1 Reply

AD Administrator Syncfusion Team February 13, 2008 06:20 PM UTC

Hi Rekha,

Thank you for your interest in Syncfusion products.

Essential Grid web allows you to sort the groups by the value of a summary.

This can be achieved by specifying your own comparer using GroupSortOrderComparer of SortColumnDescriptor . Or You can use SetGroupSummarySortOrder method of SortColumnDescriptor.

The following code snippet illustrates this.

[C#]

SortColumnDescriptor gsd = new SortColumnDescriptor("ShipVia");
gsd.SetGroupSummarySortOrder(summaryColumn2.GetSummaryDescriptorName(), "FreightTotalAvg");

//gsd.GroupSortOrderComparer = new CustomComparer(summaryColumn1.GetSummaryDescriptorName(), "FreightTotalAvg");

this.GridGroupingControl1.TableDescriptor.GroupedColumns.Add(gsd);

You can also specify the sort order using SortDirection of SortColumnDescriptor .

Please refer the sample in the below link on sorting summary values.

http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/I41390/main.htm

[Note : When you click on plus symbol , grid show with descending order of summary fields. ]

Please let me know if this helps you.

Regards,
Jaya



Loader.
Live Chat Icon For mobile
Up arrow icon