new GridSearch()
Allows a dataset to be searched using free text searches. This component utilizes a property
expression to determine which field to search on. See Searcher example for
property expression samples.
If no property is specified, a custom filterFunc can be passed in to include custom
filtering logic.
Requires to be nested within a Grid component.
Example
// Using property expression
<grid-search property="product.name in products" placeholder="Search by Product Name"></grid-search>
// Using custom filter function
<grid-search filter-func="myCustomFilterFunc" placeholder="Search by Product Name or Provider Name"></grid-search>
Members
(static) self.filtered :array
Contains array of filtered items
Type:
- array
(inner) searcher
Used to traverse an object to search for values on a given property
(inner) self
Reference to current GridSearch
Methods
(static) $onInit()
Initializes the component and validates the existence of specific attributes
(static) clear()
Clears the search text
(static) filterFunc(obj, index, arr)
Filter applied to dataset when user searches
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | The current object instance within a dataset being filtered |
index |
int | The index of the current object |
arr |
array | Reference to the dataset being filtered |
(static) restoreState()
Extracts state informatin to restore search filter
(static) saveState()
Stores the current search parameters to state.
(static) search()
Every time a user searches, we filter based on the entire dataset and then internally
store the results and call doFilter() on the parent dataset to appropriately merge results from
all relevant fitlers.
(static) wrapFilterFunc(func)
When a custom filterFunc is provided, we wrap it with this function in order to properly
pass the searchTerm to the passed in function.
Parameters:
Name | Type | Description |
---|---|---|
func |
function | Custom filterFunc to be wrapped |
Returns:
A function that has been wrapped to contain an additonal parameters