Skip to main content

Filter Dropdown

  • 3 minutes to read

#Overview

A column's filter dropdown list provides runtime filtering capabilities. A filter dropdown displays items that represent unique values within a column. To filter data against a column, an end-user should invoke the column's filter dropdown list and select any item(s) in this list. This automatically filters data (and displays records that have the selected value(s) in the current column). Filter dropdown lists also display MRU items (most recently used items) and predefined items (All), (Blanks) and (Non Blanks).

To show a filter dropdown list, an end-user should click the filter button within a column header.

FIlteringOverview

#Availability

An end-user can invoke a column's Filter Dropdown if the view's DataViewBase.AllowColumnFiltering property is set to true. Grid columns provide the ColumnBase.AllowColumnFiltering option that enables you override the default behavior specified by a View. For instance, you can set a column's ColumnBase.AllowColumnFiltering property to DefaultBoolean.False and prevent an end-user from filtering data by its values using the filter dropdown.

#Regular and Checked Dropdown Lists

The filter dropdown can be represented as a checked list (multiple items can be selected/checked simultaneously) or as a regular list of items (one item at a time can be selected).

FilterDropdownLists

By default, filter dropdowns of all columns are represented by regular lists. To use a checked filter dropdown list for a column, set a column's ColumnBase.FilterPopupMode property to FilterPopupMode.CheckedList. The following table summarizes differences between regular and checked filter dropdown lists.

Feature

Regular Filter Dropdown List

Checked Filter Dropdown List

Selection

One item at one time can be selected.

Multiple items can be selected simultaneously.

Clear Filter

Click the (All) item; this cancels any filtering by the current column.

Click the (Select All) item.

MRU Items

No

No

(Blanks) and (Non Blanks) Items

Yes

(Blanks) - Displays the records that contain DBNull values in the current column.

(Non Blanks) - Displays records that do not contain DBNull values in the current column.

No

Adding Custom Items

Yes

No

Deleting Individual Items

Yes

Yes

Data Source Limitations

No

DomainDataSource doesn't support filtering via checked filter dropdown list.

By default, a filter dropdown displays all unique values in a column. To limit the number of items displayed within the filter dropdown, use the ColumnBase.ColumnFilterPopupMaxRecordsCount property.

If the filter dropdown is represented as a checked list (multiple items can be checked/unchecked simultaneously) or by a custom template, use the ColumnBase.ImmediateUpdateColumnFilter property to enable or disable automatic updates. If automatic updates are disabled, the filter is applied after the filter dropdown has been closed.

If a column's filter dropdown is represented as a regular list of items, only one item at a time can be selected. In this instance, selecting an item automatically updates the column's filter and closes the filter dropdown.

#Custom Filter Dropdowns

If you don't want to use built-in filter dropdowns (list or checked list), you can provide your own filter dropdown via templates. In this instance, you should do the following.

For an example, please see How to: Create a Custom Filter Dropdown.

#Example: How to Customize a Column's Filter Dropdown List

This example shows how to remove default items from the 'Date' column's Filter Dropdown, and add three custom items:

  • (All) - Cancels filtering
  • Registered in 2008 - Shows users that #were registered in 2008
  • Registered in 2009 - Shows users that #were registered in 2009