Filtering in gantt control
18 Nov 20183 minutes to read
Filtering allows you to view specific or related records based on filter criteria. This can be done in the Gantt control by using the filter menu support and toolbar search support. To enable filtering in the Gantt control, set the AllowFiltering to true. Menu filtering support can be configured using the FilterSettings property and toolbar searching can be configured using the SearchSettings property.
Filter hierarchy modes
The Gantt supports a set of filtering modes with the FilterSettings.HierarchyMode property. The following are the types of filter hierarchy modes available in the Gantt control:
-
Parent: This is the default filter hierarchy mode in Gantt. The filtered records are displayed with its parent records. If the filtered records do not have any parent record, then only the filtered records will be displayed. -
Child: Displays the filtered records with its child record. If the filtered records do not have any child record, then only the filtered records will be displayed. -
Both: Displays the filtered records with its both parent and child records. If the filtered records do not have any parent and child records, then only the filtered records will be displayed. -
None: Displays only the filtered records.
Initial filter
To apply the filter at initial rendering, set the filter to predicate object in the FilterSettings.Columns property.
Filter operators
The filter operator for a column can be defined in the FilterSettings.Columns.Operator property.
The available operators and its supported data types are:
| Operator | Description | Supported Types |
|---|---|---|
| startswith | Checks whether the value begins with the specified value. | String |
| endswith | Checks whether the value ends with the specified value. | String |
| contains | Checks whether the value contains the specified value. | String |
| equal | Checks whether the value is equal to the specified value. | String | Number | Boolean | Date |
| notequal | Checks for the values that are not equal to the specified value. | String | Number | Boolean | Date |
| greaterthan | Checks whether the value is greater than the specified value. | Number | Date |
| greaterthanorequal | Checks whether the value is greater than or equal to the specified value. | Number | Date |
| lessthan | Checks whether the value is less than the specified value. | Number | Date |
| lessthanorequal | Checks whether the value is less than or equal to the specified value. | Number | Date |
NOTE
By default, the
FilterSettings.Columns.Operatorvalue isequal
Diacritics
By default, the Gantt control ignores the diacritic characters while filtering. To include diacritic characters, set the FilterSettings.IgnoreAccent to true.
In the following sample, type Perform in the TaskName column to filter diacritic characters.
Filtering a specific column by method
You can filter the columns dynamically by using the filterByColumn method.
Clear filtered columns
You can clear all the filtering condition done in the Gantt control by using the clearFiltering method. The following code snippet explains the above behaviour.