RadDataFilter allows you to create complex filter criteria with unlimited number of filter conditions combined by logical operators. The following article will show you how to create filter expressions. Start with the first section which shows how you can add filter conditions. The second section explains how you can combine the conditions.
To create a filter condition you need to define the Column/Field, the operator (AND or OR) and the Value. For instance, 'Quantity > 200' is a simple filter condition, where the Quantity is a column/field name, '>' is the "greater than" operator and '200' is the value. Here is how to create this condition using the RadDataFilter user interface.
If no filtering has been applied, RadDataFilter will contain the root operator only.
To add your first filter criteria - click the
Addbutton and select Expression. It will create a new row with several elements.
Once the expression item is added you need to set the column/field, the operator and the value.
The first drop down contains all the data fields/columns of the data source, to which RadDataFilter is bound. They are automatically populated, so you do not need to do any code to get them. The second drop down shows the available logical operators that could be applied against the type of the selected field. For example, the text field will have the Contains or Starts With operators, while the DateTime field will have Is Greater Than operators.
The groups allow you to define the relation between the conditions or groups inside it. There are two possible values that can be used as a group operator - All and Any. If the All operator is used all the conditions within the group must be fulfilled in order the entry to pass the filter condition. If the Any operator is used the entry must fulfill only one of the conditions.
By default, the control always has one root group that can contain expressions or other groups.
The following example shows a single group with two filter expressions in it. If the first OR the second condition are met the entry will fulfill the criteria.
If you change the condition all the filter expressions must be fulfilled. Here is an example for this as well.
RadDataFilter natively supports drag and drop allowing the end users to perform easy modifications of the visual tree. The drag and drop operation will also change the control`s expression.
RadDataFilter extends the drag and drop functionality provided by RadTreeView. Detailed information on how the drag-drop service is working is available here.