Usage
Signature:
interface AttributeFilter<D> extends AttributeFilterDef<D>, BaseDataFilter<D>
Generic Parameters
Parameter Description D Type of Data
Typescript Import Format
//To use this interface, import as below.
import {AttributeFilter} from "ojs/ojdataprovider";
For additional information visit:
Fields
-
(nullable) collationOptions :{sensitivity?: 'base' | 'accent' | 'case' | 'variant'}
-
An optional object that specifies collation options for the filter. Supported option is 'sensitivity'.
The sensitivity option can have one of the following values, from the least sensitive to the most sensitive:
- "base": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A.
- "accent": Only strings that differ in base letters or accents and other diacritic marks compare as unequal. Examples: a ≠ b, a ≠ á, a = A.
- "case": Only strings that differ in base letters or case compare as unequal. Examples: a ≠ b, a = á, a ≠ A.
- "variant": Strings that differ in base letters, accents and other diacritic marks, or case compare as unequal. Other differences may also be taken into consideration. Examples: a ≠ b, a ≠ á, a ≠ A.
The default is "variant".
For more details, please refer to Collator.
For example, if the data are in English, a case-insensitive search can be achieved with sensitivity of "base". A case-sensitive search can be achieved with sensitivity of "variant".
- Since:
- 12.0.0
- Inherited From:
Example
{op: '$eq', collationOptions: {sensitivity: "base"}, value: {DepartmentName: 'Marketing'}}
-
op :AttributeFilterDef.AttributeOperator
-
Operator to apply for the filter.
- Since:
- 7.0.0
- Inherited From:
-
value :any
-
Specifies the value to filter for. Value should be an object which specifies attribute/value pairs to filter on. The op will be applied to each attribute/value pair and the whole will be AND'd. For subobjects, please specify them in a nested structure.
- Since:
- 7.0.0
- Inherited From:
Examples
{op: '$eq', value: {DepartmentId: 10}}
{op: '$eq', value: {DepartmentId: 10, DepartmentName: 'Hello'}}
{op: '$eq', value: {DepartmentName: 'Hello', Location: {State: 'California'}}}
Methods
-
filter(item: D, index?: number, array?: Array<D>): boolean;
-
Specifies a filter function which has the same signature as the the callback which is specified for the JS Array.filter(): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter This function will be optionally used by the DataProvider to do local filtering. This function is required by the DataProvider so that it is possible for DataProvider implementations to at least do local filtering.
Parameters:
Name Type Argument Description item
any The current element being processed in the array. index
number <optional>
The index of the current element being processed in the array. array
Array <optional>
The array filter was called upon. - Since:
- 8.0.0
- Inherited From:
Returns:
True if the element satisfies the filter.
- Type
- boolean