Tutorial: Data Filtering Basics and Filter Panel Settings
- 3 minutes to read
This walkthrough is a transcript of the Data Filtering Basics and Filter Panel Settings video available on the DevExpress YouTube Channel.
While there are multiple different UI options for data filtering, there’s also common functionality. Regardless of the way a filter condition was applied, it can be visualized and manipulated using the Filter Panel. You will learn how to control this panel’s availability and customize its content. This video will then show you how to disable filtering UI for an individual column or the entire view.
Default Behavior
The GridControl provides multiple UI elements allowing end-users to filter data. They can select a value from the Excel-style column header dropdown, or use the Custom Filter Dialog to combine two filter conditions into one filtering expression. More complex criteria can be built using the Filter Editor dialog.
Once a filter has been applied, the Filter Panel appears at the bottom of the View. It displays the currently applied filter condition and provides additional controls.
Click the Edit Filter Button to view and customize the current filter condition using the Filter Editor.
The dropdown button allows end-users to invoke a list of recently used conditions and re-apply them.
The check box can be used to temporarily disable and enable the current filter. Click the close button to hide the filter panel and clear the current filter.
Manually Changing Filter Panel Visibility
The default behavior you’ve just experienced is that the Filter Panel appears when you apply the filter and disappears when the no condition is applied. To change this, close the application, expand the grid’s GridView.OptionsView property and set the ColumnViewOptionsView.ShowFilterPanelMode to ShowFilterPanelMode.Never.
Run the application and filter data. The Filter Panel will not appear.
Then, open the Property grid displaying View options. Set the ColumnViewOptionsView.ShowFilterPanelMode property to ShowFilterPanelMode.ShowAlways to always display the Filter Panel even if no filtering is applied to the View. In this mode, the close button is not displayed within the panel.
Hiding Filter Panel Buttons
You can also hide the Filter Panel’s Edit Filter button by expanding the ColumnView.OptionsFilter property and disabling the ColumnViewOptionsFilter.AllowFilterEditor option.
Then, set the ColumnViewOptionsFilter.AllowMRUFilterList property to false. This disables the dropdown button that gave access to the most recently used filter conditions.
Restricting End-User Filtering
You can also use grid view options to control filtering UI availability for individual columns or the entire view.
Close the application, select the Priority column and disable its OptionsColumnFilter.AllowFilter option, which is accessible using the ColumnView.OptionsFilter property.
Run the application to see that the filter button is not displayed for the Priority column. However, you can still filter data against other columns.
To prevent end-user filtering against all columns in the view, expand the View’s GridView.OptionsCustomization property and disable the GridOptionsCustomization.AllowFilter option. Now all data filtering UI is disabled.