[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Collapse]Data Shaping
      Data Sorting
      Sorting by Summary
      Display Top N Values
    [Expand]Data Formatting
   [Expand]Data Analysis
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]MVVM Enhancements
   [Expand]UI Elements
   [Expand]End-User Capabilities
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Data Sorting

The Pivot Grid allows its data to be sorted by an unlimited number of fields. To enable data sorting, set the field's PivotGridField.AllowSort property to true.

Expanded Sort Order

Data within the DXPivotGrid is always sorted against the fields displayed within the Column Header Area and Row Header Area. By default, the values are sorted in ascending order. If values are displayed hierarchically, field values in the nested groups are also sorted. The order in which field values are sorted is specified by a field's PivotGridField.SortOrder property.

End-users can toggle the sort order by clicking a field's header.

Expanded Sort Modes

Field values can be sorted by values, display text or using a custom sorting algorithm. A field's sorting mode is specified by the PivotGridField.SortMode property. By default, it is set to FieldSortMode.Default, which is the same option as the FieldSortMode.Value. Field values are sorted in alphabetical order (for text data) and in order of magnitude (for numeric and date/time data).

To sort field values by display text, set the PivotGridField.SortMode property to FieldSortMode.DisplayText. This can be useful when field values are numeric, and they are specifically formatted within the PivotGridControl.FieldValueDisplayText event handler.

To sort values using custom rules, set the field's PivotGridField.SortMode property to FieldSortMode.Custom, and handle the PivotGridControl.CustomFieldSort event to implement the required sorting logic. In OLAP and server mode, handle the PivotGridControl.CustomServerModeSort event to improve a performance.

In OLAP mode, you can sort pivot grid field data by OLAP member properties. Set the field's PivotGridField.SortMode property to FieldSortMode.DimensionAttribute and assign a property name to the field's PivotGridField.SortByAttribute property. To get a list of field properties, call the PivotGridField.GetOlapMemberProperties method.

Expanded See Also

Is this topic helpful?​​​​​​​