[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]ASP.NET WebForms Controls
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Collapse]API Reference
  [Expand]DevExpress.Data.Linq
  [Expand]DevExpress.Web
  [Expand]DevExpress.Web.ASPxGauges
  [Expand]DevExpress.Web.ASPxGauges.Base
  [Expand]DevExpress.Web.ASPxGauges.Scripts
  [Expand]DevExpress.Web.ASPxHtmlEditor
  [Expand]DevExpress.Web.ASPxHtmlEditor.Localization
  [Expand]DevExpress.Web.ASPxHtmlEditor.Scripts
  [Collapse]DevExpress.Web.ASPxPivotGrid
   [Expand]ASPxPivotCustomizationControl Class
   [Collapse]ASPxPivotGrid Class
     ASPxPivotGrid Members
     ASPxPivotGrid Constructor
    [Expand]ASPxPivotGrid Properties
    [Collapse]ASPxPivotGrid Events
      AddPopupMenuItem Event
      AfterPerformCallback Event
      BeforeGetCallbackResult Event
      BeforeLoadLayout Event
      BeforePerformDataSelect Event
      BeginRefresh Event
      ClientLayout Event
      ControlHierarchyCreated Event
      CustomCallback Event
      CustomCellDisplayText Event
      CustomCellStyle Event
      CustomCellValue Event
      CustomChartDataSourceData Event
      CustomChartDataSourceRows Event
      CustomCustomizationFormSort Event
      CustomFieldSort Event
      CustomFieldValueCells Event
      CustomFilterExpressionDisplayText Event
      CustomFilterPopupItems Event
      CustomGroupInterval Event
      CustomJsProperties Event
      CustomLoadCallbackState Event
      CustomSaveCallbackState Event
      CustomServerModeSort Event
      CustomSummary Event
      CustomUnboundFieldData Event
      DataAreaPopupCreated Event
      DataSourceChanged Event
      EndRefresh Event
      FieldAreaChanged Event
      FieldAreaChanging Event
      FieldAreaIndexChanged Event
      FieldExpandedInFieldGroupChanged Event
      FieldFilterChanged Event
      FieldFilterChanging Event
      FieldPropertyChanged Event
      FieldUnboundExpressionChanged Event
      FieldValueCollapsed Event
      FieldValueCollapsing Event
      FieldValueDisplayText Event
      FieldValueExpanded Event
      FieldValueExpanding Event
      FieldValueNotExpanded Event
      FieldVisibleChanged Event
      FilterControlCustomValueDisplayText Event
      FilterControlOperationVisibility Event
      FilterControlParseValue Event
      GridLayout Event
      GroupFilterChanged Event
      HtmlCellPrepared Event
      HtmlFieldValuePrepared Event
      LayoutUpgrade Event
      OLAPException Event
      OLAPQueryData Event
      OLAPQueryTimeout Event
      PageIndexChanged Event
      PopupMenuCreated Event
      PrefilterCriteriaChanged Event
      QueryException Event
    [Expand]ASPxPivotGrid Methods
   [Expand]ASPxPivotGridExporter Class
   [Expand]ASPxPivotGridPager Class
   [Expand]ASPxPivotGridPopupMenu Class
   [Expand]CustomCustomizationFormSortEventArgs Class
   [Expand]CustomFieldDataEventArgs Class
    CustomFieldDataEventHandler Delegate
   [Expand]CustomizePivotCellEventArgs Class
    CustomizePivotCellEventHandler Delegate
   [Expand]CustomServerModeSortEventArgs Class
   [Expand]FieldValueCell Class
    MenuItemEnum Enumeration
    PagerAlign Enumeration
   [Expand]PivotAddPopupMenuItemEventArgs Class
    PivotAddPopupMenuItemEventHandler Delegate
   [Expand]PivotAreaChangingEventArgs Class
    PivotAreaChangingEventHandler Delegate
   [Expand]PivotAreaStyle Class
   [Expand]PivotCellBaseEventArgs Class
   [Expand]PivotCellDisplayTextEventArgs Class
    PivotCellDisplayTextEventHandler Delegate
   [Expand]PivotCellStyle Class
   [Expand]PivotCellValueEventArgs Class
   [Expand]PivotChartDataSourceRow Class
    PivotCollapsedStateStoreMode Enumeration
    PivotCustomCallbackEventHandler Delegate
   [Expand]PivotCustomCellStyleEventArgs Class
    PivotCustomCellStyleEventHandler Delegate
   [Expand]PivotCustomChartDataSourceDataEventArgs Class
    PivotCustomChartDataSourceDataEventHandler Delegate
   [Expand]PivotCustomChartDataSourceRowsEventArgs Class
    PivotCustomChartDataSourceRowsEventHandler Delegate
   [Expand]PivotCustomFieldValueCellsEventArgs Class
   [Expand]PivotCustomFilterPopupItemsEventArgs Class
   [Expand]PivotCustomGroupIntervalEventArgs Class
   [Expand]PivotCustomizationFormImages Class
   [Expand]PivotDataAreaPopupCreatedEventArgs Class
    PivotDataHeadersDisplayMode Enumeration
   [Expand]PivotFieldDisplayTextEventArgs Class
    PivotFieldDisplayTextEventHandler Delegate
   [Expand]PivotFieldEventArgs Class
    PivotFieldEventHandler Delegate
   [Expand]PivotFieldFilterChangingEventArgs Class
    PivotFieldFilterChangingEventHandler Delegate
   [Expand]PivotFieldPropertyChangedEventArgs Class
    PivotFieldPropertyChangedEventHandler Delegate
   [Expand]PivotFieldStateChangedCancelEventArgs Class
    PivotFieldStateChangedCancelEventHandler Delegate
   [Expand]PivotFieldStateChangedEventArgs Class
    PivotFieldStateChangedEventHandler Delegate
   [Expand]PivotFieldValueEventArgs Class
    PivotFieldValueEventHandler Delegate
   [Expand]PivotFieldValueStyle Class
   [Expand]PivotFilterButtonPanelStyle Class
   [Expand]PivotFilterButtonStyle Class
   [Expand]PivotFilterItemStyle Class
   [Expand]PivotFilterStyle Class
   [Expand]PivotGridCallbackStateEventArgs Class
    PivotGridCallbackStateEventHandler Delegate
   [Expand]PivotGridCellTemplateContainer Class
   [Expand]PivotGridCellTemplateItem Class
   [Expand]PivotGridClientSideEvents Class
   [Expand]PivotGridCustomCallbackEventArgs Class
   [Expand]PivotGridCustomFieldSortEventArgs Class
    PivotGridCustomFieldSortEventHandler Delegate
    PivotGridCustomGroupIntervalEventHandler Delegate
   [Expand]PivotGridCustomSummaryEventArgs Class
    PivotGridCustomSummaryEventHandler Delegate
   [Expand]PivotGridCustomTotal Class
   [Expand]PivotGridCustomTotalCollection Class
   [Expand]PivotGridEmptyAreaTemplateContainer Class
   [Expand]PivotGridField Class
   [Expand]PivotGridFieldCollection Class
   [Expand]PivotGridFieldValueTemplateContainer Class
   [Expand]PivotGridFieldValueTemplateItem Class
    PivotGridHeaderFilterListBoxSearchUIVisibility Enumeration
   [Expand]PivotGridHeaderTemplateContainer Class
   [Expand]PivotGridImageProperties Class
   [Expand]PivotGridImages Class
   [Expand]PivotGridPagerStyles Class
    PivotGridPopupMenuType Enumeration
    PivotGridResetOptions Enumeration
   [Expand]PivotGridStyles Class
   [Expand]PivotGridWebFieldOptions Class
   [Expand]PivotGridWebFieldOptionsFilter Class
   [Expand]PivotGridWebGroup Class
   [Expand]PivotGridWebGroupCollection Class
   [Expand]PivotGridWebOptionsBehavior Class
   [Expand]PivotGridWebOptionsChartDataSource Class
   [Expand]PivotGridWebOptionsCustomization Class
   [Expand]PivotGridWebOptionsData Class
   [Expand]PivotGridWebOptionsDataField Class
   [Expand]PivotGridWebOptionsFilter Class
   [Expand]PivotGridWebOptionsLayout Class
   [Expand]PivotGridWebOptionsLoadingPanel Class
   [Expand]PivotGridWebOptionsPager Class
   [Expand]PivotGridWebOptionsView Class
   [Expand]PivotGroupEventArgs Class
    PivotGroupEventHandler Delegate
   [Expand]PivotHeaderStyle Class
   [Expand]PivotHtmlCellPreparedEventArgs Class
    PivotHtmlCellPreparedEventHandler Delegate
   [Expand]PivotHtmlFieldValuePreparedEventArgs Class
    PivotHtmlFieldValuePreparedEventHandler Delegate
   [Expand]PivotOlapExceptionEventArgs Class
    PivotOlapExceptionEventHandler Delegate
   [Expand]PivotOlapQueryDataEventArgs Class
   [Expand]PivotPopupMenuCreatedEventArgs Class
   [Expand]PivotQueryExceptionEventArgs Class
    PivotQueryExceptionEventHandler Delegate
    PivotScrollingMode Enumeration
   [Expand]PivotXlsExportOptions Class
   [Expand]PivotXlsxExportOptions Class
   [Expand]WebCustomExportCellEventArgs Class
   [Expand]WebCustomExportFieldValueEventArgs Class
   [Expand]WebCustomExportHeaderEventArgs Class
   [Expand]WebPivotGridOptionsPrint Class
  [Expand]DevExpress.Web.ASPxPivotGrid.Data
  [Expand]DevExpress.Web.ASPxPivotGrid.HtmlControls
  [Expand]DevExpress.Web.ASPxPivotGrid.Scripts
  [Expand]DevExpress.Web.ASPxRichEdit
  [Expand]DevExpress.Web.ASPxRichEdit.Localization
  [Expand]DevExpress.Web.ASPxRichEdit.Scripts
  [Expand]DevExpress.Web.ASPxScheduler
  [Expand]DevExpress.Web.ASPxScheduler.Commands
  [Expand]DevExpress.Web.ASPxScheduler.Commands.Dialogs
  [Expand]DevExpress.Web.ASPxScheduler.Controls
  [Expand]DevExpress.Web.ASPxScheduler.Dialogs
  [Expand]DevExpress.Web.ASPxScheduler.Drawing
  [Expand]DevExpress.Web.ASPxScheduler.Localization
  [Expand]DevExpress.Web.ASPxScheduler.Reporting
  [Expand]DevExpress.Web.ASPxScheduler.Scripts
  [Expand]DevExpress.Web.ASPxSpellChecker
  [Expand]DevExpress.Web.ASPxSpellChecker.Localization
  [Expand]DevExpress.Web.ASPxSpellChecker.Scripts
  [Expand]DevExpress.Web.ASPxSpreadsheet
  [Expand]DevExpress.Web.ASPxSpreadsheet.Localization
  [Expand]DevExpress.Web.ASPxSpreadsheet.Scripts
  [Expand]DevExpress.Web.ASPxTreeList
  [Expand]DevExpress.Web.ASPxTreeList.Internal
  [Expand]DevExpress.Web.ASPxTreeList.Localization
  [Expand]DevExpress.Web.ASPxTreeList.Scripts
  [Expand]DevExpress.Web.Captcha
  [Expand]DevExpress.Web.Data
  [Expand]DevExpress.Web.Internal
  [Expand]DevExpress.Web.Localization
  [Expand]DevExpress.Web.Mvc
  [Expand]DevExpress.Web.Mvc.BinderSettings
  [Expand]DevExpress.Web.Mvc.Controllers
  [Expand]DevExpress.Web.MVC.Scripts
  [Expand]DevExpress.Web.Mvc.UI
  [Expand]DevExpress.Web.Office
  [Expand]DevExpress.Web.Office.Internal
  [Expand]DevExpress.Web.Rendering
  [Expand]DevExpress.Web.Scripts
  [Expand]DevExpress.XtraCharts.Web
  [Expand]DevExpress.XtraCharts.Web.Designer
  [Expand]DevExpress.XtraCharts.Web.Scripts
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

ASPxPivotGrid.CustomServerModeSort Event

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

Namespace:DevExpress.Web.ASPxPivotGrid
Assembly:DevExpress.Web.ASPxPivotGrid.v18.2.dll

Expanded Syntax

Expanded Event Data

The event handler receives an argument of type CustomServerModeSortEventArgs containing data related to this event.

The following CustomServerModeSortEventArgs properties provide information specific to this event.
Property Description
Field
IsFilterPopupSorting Get the value that indicates whether the DevExpress.XtraPivotGrid.PivotGridControl.CustomServerModeSort event is raised.
OLAPMember1 Get the first member being compared.
OLAPMember2 Get the second member being compared.
Result
Value1 Gets the first value being compared.
Value2 Gets the second value being compared.

Expanded Remarks

Handle the CustomServerModeSort event to provide a custom sorting algorithm in OLAP and server mode for a specific field. Note, that the DevExpress.XtraPivotGrid.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 DevExpress.XtraPivotGrid.CrossAreaKey class and assign values to this variable using the DevExpress.XtraPivotGrid.CustomServerModeSortEventArgsBase<T>.GetCrossAreaKey method.

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

In the event handler, compare these values and assign the result to the DevExpress.XtraPivotGrid.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 DevExpress.XtraPivotGrid.CustomServerModeSortEventArgsBase<T>.OLAPMember1 and DevExpress.XtraPivotGrid.CustomServerModeSortEventArgsBase<T>.OLAPMember2 properties.

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

In OLAP mode, when you get the DevExpress.XtraPivotGrid.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 DevExpress.XtraPivotGrid.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 DevExpress.XtraPivotGrid.PivotGridFieldBase.AutoPopulatedProperties property to improve performance.

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

Expanded Example

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T262815.

This example demonstrates how to implement a custom sorting algorithm by handling the CustomServerModeSort event. The "Month" column field is sorted by the "Dairy Products" row using the cross area key, and the "Category" field is sorted directly by the 1996 year.

Expanded See Also

Is this topic helpful?​​​​​​​