PivotGridFieldBase.SortMode Property
Gets or sets how the field’s data is sorted when sorting is applied to it.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.PivotGrid.v19.2.Core.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
PivotSortMode | **Default** | A PivotSortMode value that specifies how the field’s data is sorted in sort mode. |
Available values:
Name | Description |
---|---|
Default | Sorts the field’s data by the field’s values (these are synchronized with the values from the bound data source). |
Value | Sorts the field’s data by the field’s values (these are synchronized with the values from the bound data source). |
DisplayText |
|
Custom | Enables custom sorting of the field’s data using the CustomFieldSort event or the CustomServerModeSort event in OLAP mode. |
Key | Sorts the field’s data by key attributes (in OLAP mode). |
ID | Sorts by a level member’s ID (in OLAP mode). |
None | Data is not sorted - it is displayed in the order the data source specifies. This option is in effect only in OLAP mode. |
DimensionAttribute | Sorts the field’s data by the OLAP member property (in OLAP mode). |
Remarks
The SortMode property determines the algorithm used to sort the field’s data (by display text, edit value or using a custom sorting algorithm).
To provide custom sorting, set the SortMode property to PivotSortMode.Custom and handle the CustomFieldSort event. To provide custom sorting in OLAP and server mode, handle the CustomServerModeSort event. To sort the pivot grid field’s data by an OLAP member property, set the SortMode property to PivotSortMode.DimensionAttribute and assign the property name to PivotGridFieldBase.SortByAttribute property.
For more information, refer to the platform-specific API articles:
WinForms | ASP.NET | ASP.NET MVC | WPF |
---|---|---|---|
CustomFieldSort | CustomFieldSort | CustomFieldSort | CustomFieldSort |
CustomServerModeSort | CustomServerModeSort | CustomServerModeSort | CustomServerModeSort |
To apply sorting to a field, set the field’s PivotGridFieldBase.SortOrder property to PivotSortOrder.Ascending or PivotSortOrder.Descending. This will arrange the field’s values in ascending or descending order using the algorithm that is specified by the SortMode property.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SortMode property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.