PivotGridControl.CustomServerModeSort Event

In OLAP and server mode, provides the capability to sort data using custom rules.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v20.1.dll


public event EventHandler<CustomServerModeSortEventArgs> CustomServerModeSort
Public Event CustomServerModeSort As EventHandler(Of CustomServerModeSortEventArgs)

Event Data

The CustomServerModeSort event's data class is CustomServerModeSortEventArgs. The following properties provide information specific to this event:

Property Description
Field Gets the field being processed. Inherited from PivotFieldEventArgsBase<T>.
IsFilterPopupSorting Get the value that indicates whether the PivotGridControl.CustomServerModeSort event is raised.
OLAPMember1 Get the first member being compared.
OLAPMember2 Get the second member being compared.
Result Gets or sets the result of a custom comparison.
Value1 Gets the first value being compared.
Value2 Gets the second value being compared.


Handle the CustomServerModeSort event to provide a custom sorting algorithm in OLAP and server mode for a specific field. Note, that the PivotGridFieldBase.SortMode property of the sorted field should be set to Custom to apply custom sorting. Otherwise, the CustomServerModeSort event will not be raised.

The field being processed is specified using the PivotFieldEventArgsBase<T>.Field property.

Specify the cross area field values by which you want to sort the data by creating a new instance of the CrossAreaKey class and assign values to this variable using the CustomServerModeSortEventArgsBase<T>.GetCrossAreaKey method.

Use the CustomServerModeSortEventArgsBase<T>.GetCellValue1 and CustomServerModeSortEventArgsBase<T>.GetCellValue2 methods to get cell values.

In the event handler, compare these values and assign the result to the CustomServerModeSortEventArgsBase<T>.Result property.

  • Set the value to -1 to make the current object precede the compared object in the sort order.
  • Set the value to 0 to leave the current object in the same position as the compared object.
  • Set the value to 1 to make the current object follow the compared object in the sort order.

In OLAP, the members to be compared are specified by the CustomServerModeSortEventArgsBase<T>.OLAPMember1 and CustomServerModeSortEventArgsBase<T>.OLAPMember2 properties.

To sort data using the OLAP member properties, set the PivotGridFieldBase.SortMode property of the sorted field to DimensionAttribute and use the PivotGridFieldBase.SortByAttribute property to sort data.

In OLAP mode, when you get the IOLAPMember.Properties property, the PivotGridControl sends a query to the server every time for each member. While sorting data using the CustomServerModeSort event, you can use the PivotGridFieldBase.AutoPopulatedProperties to specify the list of OLAP member properties which should be returned with a data query from the server. Create a new collection of OLAP member attributes using the PivotGridFieldBase.AutoPopulatedProperties property to improve performance.

To get the OLAP member properties values, use the IOLAPMember.AutoPopulatedProperties property.

See Also