new Search( [options])
Search Control. This is the base class for search controls. You can use it for simple custom search or as base to new class.
Parameters:
Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Properties
|
Fires:
- event:select
- change:input
Extends
Methods
-
autocomplete(s, cback)
-
Autocomplete function
Parameters:
Name Type Description s
string search string
cback
function a callback function that takes an array to display in the autocomplete field (for asynchronous search)
Returns:
an array of search solutions or false if the array is send with the cback argument (asnchronous)
- Type
- Array | false
-
clearHistory()
-
Remove previous history
-
equalFeatures(f1, f2)
-
Test if 2 features are equal
Parameters:
Name Type Description f1
any f2
any Returns:
- Type
- boolean
-
getHistory()
-
Get history table
-
getTitle(f)
-
Returns the text to be displayed in the menu
Parameters:
Name Type Description f
any feature to be displayed
Returns:
the text to be displayed in the index, default f.name
- Type
- string
-
restoreHistory()
-
Restore history (from the localstorage)
-
saveHistory()
-
Save history (in the localstorage)
-
search()
-
Force search to refresh
-
select(f)
-
A ligne has been clicked in the menu > dispatch event
Parameters:
Name Type Description f
any the feature, as passed in the autocomplete
-
setInput(value, search)
-
Set the input value in the form (for initialisation purpose)
Parameters:
Name Type Description value
string search
boolean to start a search