[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Expand]Summarization
     Grouping
    [Expand]Sorting
    [Collapse]Filtering
      Filtering Overview
      Group Filtering
      Filter
     [Expand]Filtering by Summaries
     [Expand]OLAP Filtering Specifics
    [Expand]Editing
     Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]Design-Time Features
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[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)

Filter

The Filter feature serves two purposes. First, it enables PivotGridControl to display a Filter Editor allowing an end-user to apply filtering to the pivot grid's underlying data source at runtime. Second, you can filter the underlying data source in code, without displaying a Filter Editor to end users. The Excel style filter is used by default. To enable the Excel style, set the application-wide static setting WindowsFormsSettings.ColumnFilterPopupMode to ColumnFilterPopupMode.Excel, or set the option PivotGridOptionsFilterPopup.FieldFilterPopupMode to the FieldFilterPopupMode.Excel value.

In classic version you can see the caption Prefilter instead of Filter. This is the case if Excel-style dropdown filters are disabled.

Note

The Filter is not supported in an OLAP mode.

Expanded Filter Editor

By default, end users can invoke a Filter Editor at runtime via the context menu. The Filter Editor provides an advanced UI that allows end-users to build complex filter criteria with an unlimited number of filter conditions combined by logical operators. The resulting filter condition is combined with filter conditions defined by individual fields.

For the classic version the context menu looks as follow:

The Filter Editor may contain a text panel, a visual panel, or both. This characteristic is determined by the PivotGridControl.DefaultFilterEditorView property.

To learn how to interact with a Filter Editor at runtime, see the Filter Editor topic from End-User Documentation.

You can prevent end-users from invoking a Filter Editor by disabling the PivotGridOptionsCustomization.AllowPrefilter option. In this instance, the Show Filter context menu item will be hidden, and the Filter Editor will be able to be invoked only in code.

To prevent a particular field from being displayed in a Filter Editor, and used in filter criteria built by end-users, use the PivotGridFieldOptions.ShowInPrefilter property.

Expanded Filter Panel

When the PivotGridOptionsCustomization.AllowPrefilter option is enabled, and a filter condition is specified, Pivot Grid Control displays a Filter Panel.

The Filter Panel displays:

  • Filter expression displays active filters.
  • Edit button that invokes a Filter Editor.
  • Check box that temporarily enables/disables the filtering.
  • Clear button that resets the current filter condition.
  • MRU filter button that opens MRU filter list.
  • <b>MRU filter list</b> that displays the last filters applied to the Pivot Grid.
Note

The MRU list is not available if the filter criteria display style is Visual (the WindowsFormsSettings.FilterCriteriaDisplayStyle property value equals FilterCriteriaDisplayStyle.Visual).

Use the PivotGridAppearances.PrefilterPanel property to customize the Prefilter Panel appearance.

For the classic version the filter panel looks as follow:

The Prefilter Panel displays:

  • Filter expression displays active filters.
  • Edit button that invokes a Filter Editor.
  • Check box that temporarily enables/disables the filtering.
  • Clear button that resets the current filter condition.

Expanded Using Filter in Code

The Prefilter allows you to access its settings and specify filter criteria in code. To do this, use the PivotGridControl.Prefilter property. The returned object exposes the following properties and methods.

Prefilter.Criteria, BaseFilter.CriteriaString

Get or set a filter expression.

Prefilter.ChangePrefilterVisible

Toggles the Filter Editor visibility state.

BaseFilter.Enabled

Gets or sets whether filtering is enabled or not.

When you create a filter expression in code, use the PivotGridFieldBase.PrefilterColumnName property to refer to a field. The sample below shows how to do this.

Note

Prefilter cannot filter data against data fields. If a data field is used in a filter criteria that has been specified in code, an error message will be displayed within the Prefilter Panel. This message also appears if a filter criteria contains a field name that does not exist. Use the PrefilterBase.State property to determine whether the filter criteria is valid or not.

To learn more about filter criteria syntax, see the Pivot Grid Expression Syntax document.

After a filter condition has been changed via a Filter Editor or in code, the PivotGridControl.PrefilterCriteriaChanged event is raised.

Expanded Example

Expanded See Also

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