HOME PAGE | DOWNLOAD | TUTORIALS | XtraReports
Devexpress

Saturday, July 14, 2012

XtraGrid - Applying Filters

In this lesson, you will learn how to build and apply complex filter criteria using the “Filter Editor”. The XtraGrid provides the “Filter Editor” tool, which enables end-user to build complex filter criteria with an unlimited number of filter conditions combined by logical operators.
End-user can invoke the Filter Editor by using the “Edit Filter” button, which is displayed within the filter panel.
1.       The visibility of this panel is controlled by the “Show Filter Panel Mode” property.
2.       By default, the filter panel is shown when the filtering is applied to a view.
3.       Otherwise, it is hidden.
4.       I can set this property to “show always”, so that the filter panel can always be displayed at the bottom of the view.
5.       The availability of the filter editor is controlled by the “Allow Filter Editor” option.
6.       By default, this property is set to true, thus enabling the end-users to use the “Filter Editor”.
7.       So, now I can run the application to demonstrate how to work with the “Filter Editor”.
8.       I invoke it.
9.       A new empty condition has already been added to the filter criteria.
10.   I’m going to select orders made between the 20th of May 1994, and 10th of November 1994.
11.   First, I select the column for which the filter condition will be applied to. This is the “Order Date” column.
12.   In the operator drop-down, I select the “Is between” item.
13.   And finally, I can select the range of dates for the “Is between” operator.
14.   The editor used in these value boxes, by the way, is determined by the type of the editor which is assigned to the corresponding column.
15.   In this case, it’s a “Date/Time” editor, which drops down a calendar control, enabling the user to easily select dates.
16.   And I’m done!
17.   Now, I’m going to add a second condition, which selects the orders whose freight cost is more than $50.
18.   I apply this condition to the “Freight” column.
19.   I select the “Is greater than” operator, and then type in $50.
20.   The third condition I’m going to use, selects only those orders, where the shipping country is either USA, Brazil or Belgium.
21.   This condition is applied to the “Ship Country” column.
22.   I select the “Is any of” operator from the drop-down.
23.   Now, I need to add a list of the countries.
24.   I can start by selecting USA, and so I can add Brazil, and I can continue adding to the list now by adding Belgium.
25.   And I’m done!
26.   I apply this filter criteria to the view and close the filter editor.
27.   You can see that only those orders that match our criteria are displayed within the view.
28.   The filter criteria which is applied to the view is displayed within the filter panel at the bottom of the view.
Enhanced by Zemanta

No comments:

Post a Comment