Skip to main content

PivotGridFieldBase.SortBySummaryInfo Property

Contains the settings used to sort the values of the current column field or row field by summary values in rows/columns.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v24.1.Core.dll

NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

[XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)]
[XtraSerializablePropertyId(2)]
public PivotGridFieldSortBySummaryInfo SortBySummaryInfo { get; }

Property Value

Type Description
PivotGridFieldSortBySummaryInfo

A PivotGridFieldSortBySummaryInfo object which contains the settings used to sort the current field’s values by summary values in columns/rows.

Remarks

By default, the values of column fields and row fields are arranged in alphabetical order (for text data) and in order of magnitude (for numeric and date/time data).

If the current field is a row field, the SortBySummaryInfo property allows you to arrange this field’s values according to the summary values in any column. Similary, if the current field is a column field, the SortBySummaryInfo property can be used to arrange this field’s values according to the summary values in any row. See How to: Sort Data by Columns (Rows) in Code, for an example.

The SortBySummaryInfo property along with the PivotGridFieldBase.TopValueCount property allows you to implement a Top X Values report, which will show only the first records while ignoring the rest. The Top Values demo illustrates this functionality.

 

Note

In web applications, you must specify the field’s ID property.

Example

This example demonstrates how to sort the values of a ‘Sales Person’ column field by summary values calculated against an ‘Order Amount’ data field. To do this, the PivotGridFieldSortBySummaryInfo.Field property of the ‘Sales Person’ field is set to reference the ‘Order Amount’ field. As a result, the values will be arranged in the order specified by the summary values.

The following images show the PivotGridControl before and after the field values are sorted by the summary values.

Before:

PivotGridField.SortBySummary_None

After:

PivotGridField.SortBySummary_Sum

pivotGridControl1.Fields["Sales Person"].SortBySummaryInfo.Field = 
  pivotGridControl1.Fields["Order Amount"];
See Also