Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Expand]Aggregation
     Grouping
    [Collapse]Sorting
      Data Sorting
      Display Top N Values
      Sorting by Summary
    [Expand]Filtering
   [Expand]Data Analysis
   [Expand]Data Formatting
   [Expand]Layout
   [Expand]Appearance
   [Expand]Data Export
   [Expand]Design-Time Features
   [Expand]UI Elements
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Sorting by Summary

ASPxPivotGrid can sort its column field values by any row and row field values by any column (the Sorting by Summary feature). The following picture shows a pivot grid with Order Month field values sorted by the Order Amount Grand Total column.

Expanded End-User Sorting by Summary

For end-users, sorting by summary is available via context menus, invoked when right-clicking an innermost column or row header.

When sorting by summary is applied to a field, a column/row by which field values are sorted displays the image in its header (see the pivot grid image above).

Expanded Availability

By default, sorting by summary is available for all fields if they are displayed within the Column Header Area or Row Header Area.

You can disable this functionality for end-users in two ways.

Note that in this instance settings of individual fields take priority over ASPxPivotGrid settings.

Expanded Sorting by Summary in Code

Individual fields expose the PivotGridFieldBase.SortBySummaryInfo property that returns a PivotGridFieldSortBySummaryInfo instance. This object provides access to Sort by Summary settings.

To sort data by summaries in code, you need to specify a data field whose summary values should define the sort order.

To specify a data field, do one of the following.

After you have specified a data field, ASPxPivotGrid sorts field values by a Grand Total column/row that corresponds to this data field. To sort field values by any other column/row, you should identify this column/row via the PivotGridFieldSortBySummaryInfo.Conditions property.

The PivotGridFieldSortBySummaryInfo.Conditions property provides access to a collection of sort conditions (PivotGridFieldSortCondition objects). Each condition identifies a field value, so that the whole collection identifies a column/row. For instance, the highlighted column on the image below is identified by three sort conditions.

To implement a sorting shown on this image, you should create three PivotGridFieldSortCondition instances and add them to the PivotGridFieldSortBySummaryInfo.Conditions collection.

To sort field values by a total column/row (for instance, the Qtr 4 Total column from the image above), you need to create only two sort conditions.

To sort data by a custom total column/row, you should specify its type via the PivotGridFieldSortBySummaryInfo.CustomTotalSummaryType property.

Note

In an OLAP mode, create sort conditions via a PivotGridFieldSortCondition.PivotGridFieldSortCondition constructor overload that takes an OLAP member's unique name as a parameter. To obtain an OLAP member for a field value, use the ASPxPivotGrid.GetFieldValueOLAPMember method. This method returns an object that implements the IOLAPMember interface. To access the OLAP member unique name, use its IOLAPMember.UniqueName property. For an example, see How to: Sort Data by Individual Columns (Rows) in OLAP Mode.

Note

Running totals is not supported when you sort data by summary.

Expanded Example

How would you rate this topic?​​​​​​​