PivotGridSettings.CustomServerModeSort Property
In OLAP and server mode, provides the capability to sort data using custom rules.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
Property Value
Type | Description |
---|---|
EventHandler<CustomServerModeSortEventArgs> | A CustomServerModeSortEventArgs delegate method allowing you to implement custom processing. |
Remarks
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 by the ID using the PivotGridField.ID property.
Specify the cross area field values by which you want to sort the data by creating a new instance of CrossAreaKey class and assigning 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 property values, use the IOLAPMember.AutoPopulatedProperties property.