[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
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Expand]Aggregation
     Grouping
    [Collapse]Sorting
      Data Sorting
      Sorting by Summary
      Display Top N Values
    [Expand]Filtering
    [Expand]Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Appearance
   [Expand]MVVM Enhancements
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [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
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[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?​​​​​​​