FilterService

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.

NameParametersDescription
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.

YearBrandColorVin
1987FiatMaroonee8a89d8
1968RenaultWhite642b3edc
1981RenaultBlack19ec7580
1986VWRed39980f30
1981FiatBrownec9cc4e4
1965VWGreen09a06548
2007MercedesBlue05c47246
1962FiatGreena9cb87aa
1999BMWYelloweae758fa
1964JaguarYellow1241c403

Following is the list of structural style classes, for theming classes visit theming page.

NameParametersDescription
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.
Templates
Highly customizable application templates to get started in no time with style. Designed and implemented by PrimeTek.