FilterService is a helper utility to filter collections against constraints.
import { FilterService } from 'primeng/api';FilterService needs to be injected into your component. Filters are accessed with FilterService.filters.
| Name | Parameters | Description |
|---|---|---|
| startsWith | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value starts with the filter value |
| contains | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value contains the filter value |
| endsWith | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value ends with the filter value |
| equals | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value equals the filter value |
| notEquals | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value does not equal the filter value |
| in | value: Value to filter filter[]: An array of filter values filterLocale: Locale to use in filtering | Whether the value contains the filter value |
| lt | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value is less than the filter value |
| lte | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value is less than or equals to the filter value |
| gt | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value is greater than the filter value |
| gte | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value is greater than or equals to the filter value |
| is | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value equals the filter value, alias to equals |
| isNot | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the value does not equal the filter value, alias to notEquals. |
| before | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the date value is before the filter date. |
| after | value: Value to filter filter: Filter value filterLocale: Locale to use in filtering | Whether the date value is after the filter date. |
FilterService can be extended by adding new constraints using the register function.
A custom equals filter that checks for exact case sensitive value is registered and defined as a match mode of a column filter.
| Year | Brand | Color | Vin |
|---|---|---|---|
| 1987 | Fiat | Maroon | ee8a89d8 |
| 1968 | Renault | White | 642b3edc |
| 1981 | Renault | Black | 19ec7580 |
| 1986 | VW | Red | 39980f30 |
| 1981 | Fiat | Brown | ec9cc4e4 |
| 1965 | VW | Green | 09a06548 |
| 2007 | Mercedes | Blue | 05c47246 |
| 1962 | Fiat | Green | a9cb87aa |
| 1999 | BMW | Yellow | eae758fa |
| 1964 | Jaguar | Yellow | 1241c403 |
Following is the list of structural style classes, for theming classes visit theming page.
| Name | Parameters | Description |
|---|---|---|
| filter | value[]: An array of values to filter fields[]: An array of properties in the value object filterValue: Filter value filterMatchMode: Constraint filterLocale: Locale to use in filtering | Whether the property values of the given value collection matches the filter. |
| filters | - | Property to access constraints collection. |
| register | name: string fn: Filter callback | Registers a new constraint in filters. |