Usage
Signature:
interface TextFilter<D> extends TextFilterDef, BaseDataFilter<D>
Generic Parameters
Parameter Description D Type of Data
Typescript Import Format
//To use this interface, import as below.
import {TextFilter} from "ojs/ojdataprovider";
For additional information visit:
Fields
-
(nullable) matchBy :('phrase'|'startsWith'|'contains'|'fuzzy'|'unknown')
-
Specifies the text filter matching mechanism.
- 'phrase' - matches phrases at the beginning of the words case insensitively and enforces the relative order
- 'startsWith' - case-insensitive starts with
- 'contains' - case-insensitve contains
- 'fuzzy' - uses TextFilter's fuzzy matching mechanism
- 'unknown' - uses TextFilter's default matching mechanism
- Default Value:
'unknown'
- Since:
- 14.1.0
- Inherited From:
Examples
{text: 'engineer', matchBy: 'contains'}
{text: 'engineer', matchBy: 'phrase'}
{text: 'aero engineer', matchBy: 'phrase'}
-
text :string
-
Specifies the text to filter for. It is up to the DataProvider implementation to decide which attributes to apply the filter to and also the exact filtering logic used, such as case insensitivity, etc. In addition, for attributes which contain non-string values, the type coercion rule expected is to call toString() on that value. If the value is an object which does not have a string representation then the value does not satisfy the filter.
- Since:
- 8.0.0
- Inherited From:
Example
{text: 'abc search'}
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