Methods
(static) activeFilterComparators(filterConfiguration)
- Source:
Returns an array of all comparators that are being actively filtered
Example
const filterConfiguration = {
"operator": "and",
"filters": [
{
"operator": "and",
"filters": [
{
"key": "formData.person.firstName",
"comparator": "startswith",
"value": "c"
},
{
"key": "invalid no comparator",
"value": "e"
}
{
"key": "formData.person.lastName",
"comparator": "endswith",
"value": "e"
}
]
}
]
}
const activeFilters = sdk.filter.activeFilterKeys(filterConfiguration);
// Returns ['startswith', 'endswith']
Parameters:
| Name | Type | Description |
|---|---|---|
filterConfiguration |
Object | A filter configuration object |
(static) activeFilterKeys(filterConfiguration)
- Source:
Returns an array of all keys that are being actively filtered on
Example
const filterConfiguration = {
"operator": "and",
"filters": [
{
"operator": "and",
"filters": [
{
"key": "formData.person.firstName",
"comparator": "startswith",
"value": "c"
},
{
"key": "invalid no comparator",
"value": "e"
}
{
"key": "formData.person.lastName",
"comparator": "endswith",
"value": "e"
}
]
}
]
}
const activeFilters = sdk.filter.activeFilterKeys(filterConfiguration);
// Returns ['formData.person.firstName', 'formData.person.lastName']
Parameters:
| Name | Type | Description |
|---|---|---|
filterConfiguration |
Object | A filter configuration object |
(static) activeFilterOperators(filterConfiguration)
- Source:
Returns an array of all comparators that are being actively filtered
Example
const filterConfiguration = {
"operator": "and",
"filters": [
{
"operator": "nor",
"filters": [
{
"key": "formData.person.firstName",
"comparator": "startswith",
"value": "c"
},
{
"key": "invalid no comparator",
"value": "e"
}
{
"key": "formData.person.lastName",
"comparator": "endswith",
"value": "e"
}
]
}
]
}
const activeFilterOperators = sdk.filter.activeFilterOperators(filterConfiguration);
// Returns ['and', 'nor']
Parameters:
| Name | Type | Description |
|---|---|---|
filterConfiguration |
Object | A filter configuration object |
(static) activeFilters(filterConfiguration)
- Source:
Returns an array of all active filters
Example
const filterConfiguration = {
"operator": "and",
"filters": [
{
"operator": "and",
"filters": [
{
"key": "formData.person.firstName",
"comparator": "startswith",
"value": "c"
},
{
"key": "invalid no comparator",
"value": "e"
}
{
"key": "formData.person.lastName",
"comparator": "endswith",
"value": "e"
}
]
}
]
}
const activeFilters = sdk.filter.activeFilters(filterConfiguration);
const returns = [
{
"key": "formData.person.firstName",
"comparator": "startswith",
"value": "c"
},
{
"key": "formData.person.lastName",
"comparator": "endswith",
"value": "e"
}]
Parameters:
| Name | Type | Description |
|---|---|---|
filterConfiguration |
Object | A filter configuration object |
(static) activeFilterValues(filterConfiguration)
- Source:
Returns an array of all values that are being actively used by a filter
Example
const filterConfiguration = {
"operator": "and",
"filters": [
{
"operator": "nor",
"filters": [
{
"key": "formData.person.firstName",
"comparator": "startswith",
"value": "c"
},
{
"key": "invalid no comparator",
"value": "e"
}
{
"key": "formData.person.lastName",
"comparator": "endswith",
"value": "a"
}
]
}
]
}
const activeFilterValues = sdk.filter.activeFilterValues(filterConfiguration);
// Returns ['c', 'a']
Parameters:
| Name | Type | Description |
|---|---|---|
filterConfiguration |
Object | A filter configuration object |
(static) filterChangeString(filterConfiguration)
- Source:
Returns an string representation of a filter configuration.
Often used to check if a user has changed the filter in any way, the string only takes into consideration active valid filters
Example
const filterConfiguration = {
"operator": "and",
"filters": [
{
"operator": "nor",
"filters": [
{
"key": "formData.person.firstName",
"comparator": "startswith",
"value": "c"
},
{
"key": "invalid no comparator",
"value": "e"
}
{
"key": "formData.person.lastName",
"comparator": "endswith",
"value": "a"
}
]
}
]
}
// Watch this string for changes
const changeString = sdk.filter.filterChangeString(filterConfiguration);
Parameters:
| Name | Type | Description |
|---|---|---|
filterConfiguration |
Object | A filter configuration object |
(static) isValidFilter(filter)
- Source:
Check if an object is a valid filter
Example
// Missing a 'key'
const invalidFilter = sdk.filter.isValidFilter({comparator:'in', values:['Red', 'Green', 'Blue']})
// returns false
const validFilter = sdk.filter.isValidFilter({key:'favoriteColor', comparator:'in', values:['Red', 'Green', 'Blue']})
// returns true
Parameters:
| Name | Type | Description |
|---|---|---|
filter |
Object | The filter block to check |