Q filter Class
Implements an input that filters an associated list (like an autocomplete)
Constructor
Q filter
-
[options]
Parameters:
-
[options]
Object optionalOverride various options for this tool
-
[name='filter']
String optionalThe name of the text input
-
[value='']
String optionalThe initial value of the text input
-
[placeholder]
String optionalAny placeholder text
-
[placeholders={}]
Object optionalOptions for Q/placeholders, or null to omit it
-
[results='']
String optionalHTML to display in the results initially. If setting them later, remember to call stateChanged('results')
-
[onFilter]
Q.Event optionalYou are meant to attach an event handler to fetch and update results by editing the contents of the element pointed to by the second argument. The first argument is the content of the text input.
-
[onChoose]
Q.Event optionalThis event occurs when one of the elements with class "Q_filter_result" is chosen. It is passed (element, details) where you can modify details.text to set the text which will be displayed in the text input to represent the chosen item.
-
[onClear]
Q.Event optionalThis event occurs when the filter input is cleared
-
[onFocus]
Q.Event optionalThis event occurs when input element focused
-
Returns:
Methods
begin
()
Boolean
Show the filtered results
Returns:
May return false if the tool is suspended, etc.
choose
-
[element]
Choose an item in the results.
Parameters:
-
[element]
HTMLElement optionalthe element to choose
end
-
[chosenText]
Hide the filtered results
Parameters:
-
[chosenText]
Object optionalthe text of the chosen option, if any, to display in the input
setText
-
[chosenText]
-
[dontRefresh]
Set text in the input