Skip to main content
A newer version of this page is available. .

Filtering

  • 3 minutes to read

Filtering allows you to display a subset of records from a data source. Our grid control allows you to construct complex filter criteria by combining simple filter conditions with logical operators for individual items (columns and card rows).

Data filtering in a grid View is implemented by the data controller. A grid View’s DataController.Filter property specifies a TcxFilterCriteria object that allows you to manage and apply filter conditions. TcxFilterCriteria is the base class for the TcxDataFilterCriteria and TcxDBDataFilterCriteria classes for working in unbound and bound modes, respectively.

To apply filter conditions set via the DataController.Filter object, set the TcxDataFilterCriteria.Active property to True. The filter panel displays the text representation of the applied filter criteria.

At runtime, end-users can customize the filter criteria as required using a grid View’s built-in capabilities.

As mentioned above, filter criteria consist of simple filter conditions combined with logical operators. A simple filter condition specifies the item for which the condition is applied, the comparison operator and the value with which to compare it.

Assume we have a table providing information on companies. The table contains the Company and City fields. The following simple filter condition, if applied, selects the companies located in Madrid:

City = ‘Madrid’

Suppose, you need to select the companies starting with A and located in Madrid or Caracas:

(City = ‘Madrid’ OR City = ‘Caracas’) AND (Company LIKE ‘A%’)

This filter consists of three simple conditions. A simple condition consists of a TcxFilterCriteriaItem object and this specifies the item (column) for which the filter is applied, the operator and the value with which to compare it. Simple conditions are combined by a logical operator and stored in lists of the TcxFilterCriteriaItemList class. In addition, these lists can be combined by an operator with other lists and simple conditions.

For the filter criteria shown above, two lists are used. The first list stores simple conditions (City = ‘Madrid’) and (City = ‘Caracas’). These conditions are combined by the OR operator. The second list points to a simple condition (Company LIKE ‘A%’) defined by the first list. Conditions in the second list are combined by the AND operator.

Note

The data controller uses multi-threaded algorithms to improve performance when filtering, sorting or grouping data in “classic” data loading modes – when data-aware operations are performed on the client side, rather than on the server side (as in server mode). Refer to the Multi-Threaded Data Processing topic to learn more.

See Also