Filter
An advanced parameter used for filtering
Specification
options
Available types:
array
Left-side operands specified like option objects.
string
A URL of the RPC returning the list of left-side operands.
object
Detailed configuration for receiving the left-side operands.
Available parameters:
store
array
An array of left-side operands specified like an Option object.
store
string
A URL of the RPC returning the list of left-side operands.
logic
string
Allowed values: both, and, or. Specifies if only and, or or both types of filters are available.
operators
array
Custom operators. The data structure is the same as the grouped select box.
Examples
Basic usage of a filter

[
{
"name": "search",
"label": "Search criteria",
"type": "filter",
"options": [
{
"label": "Email",
"value": "email"
},
{
"label": "Username",
"value": "username"
}
]
}
][
[
{
"a": "username",
"b": "A",
"o": "text:startwith"
},
{
"a": "username",
"b": "B",
"o": "text:endwith"
}
],
[
{
"a": "username",
"b": "C",
"o": "text:endwith"
}
]
]Custom operators
Many services have their own search options and syntax. That's why you may need to define your own operators. You can specify them inside the options object. You can create multiple groups of operators.

[
{
"name": "search",
"type": "filter",
"label": "Search criteria",
"options": {
"operators": [
{
"label": "Text",
"options": [
{
"label": "Matches",
"value": "matches"
},
{
"label": "Doesn't match",
"value": "doesntmatch"
}
]
},
{
"label": "Numbers",
"options": [
{
"label": "Three times larger",
"value": "threetimeslarger"
}
]
}
]
}
}
]Only and, only or logic
and, only or logicYou may need to set up an only and or only or filter. You can do this by setting the logic option. In this example, you can see how to create the filter parameter with only and logic. For the or alternative, change the keyword.

[
{
"name": "search",
"type": "filter",
"label": "Search criteria",
"options": {
"logic": "and"
}
}
]Custom options, custom operators, and custom logic
This example combines custom options, custom operators, and custom logic.

[
{
"name": "search",
"type": "filter",
"label": "Search criteria",
"options": {
"logic": "and",
"store": [
{
"label": "Email",
"value": "email"
},
{
"label": "Username",
"value": "username"
}
],
"operators": [
{
"label": "Text",
"options": [
{
"label": "Matches",
"value": "matches"
},
{
"label": "Doesn't match",
"value": "doesntmatch"
},
{
"label": "Contains",
"value": "contains"
}
]
}
]
}
}
]Last updated

