Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Expand]Summarization
     Grouping
    [Collapse]Sorting
      Sorting Data
      Displaying Top N Values for a Field
      Sorting by Summary
    [Expand]Filtering
    [Expand]Editing
     Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]Design-time Features
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core 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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Sorting Data

Expanded Sort Order

Data within the PivotGridControl 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, the values in the child groups are also sorted. The order in which the field values are sorted is specified by the PivotGridFieldBase.SortOrder property. End-users can do the same by clicking the field header.

Expanded Sort Modes

Field values in the Pivot Grid Control can be sorted by values, display text or use a custom sorting algorithm. A field's sorting mode is determined by the PivotGridFieldBase.SortMode property. By default, it is set to DevExpress.XtraPivotGrid.PivotSortMode.Default, which is currently the same option as PivotSortMode.Value, and so field values are sorted in alphabetical order (for text data) and in order of magnitude (for numeric and date/time data).

In specific cases, you may need to sort the field values by the displayed text. Assume that field values are numeric and they are specifically formatted via the PivotGridControl.FieldValueDisplayText event. In this instance, set the field's PivotGridFieldBase.SortMode property to PivotSortMode.DisplayText to sort according to the formatted values, but not according to the underlying values.

If you need to implement a custom sorting algorithm, set the field's PivotGridFieldBase.SortMode property to PivotSortMode.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 PivotGridFieldBase.SortMode property to PivotSortMode.DimensionAttribute and assign a property name to the field's PivotGridFieldBase.SortByAttribute property. To get a list of field properties, call the PivotGridFieldBase.GetOLAPMemberProperties method.

Expanded See Also

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