The Search
class is the main entry point. It wires up event handlers along
with the connection to the suggestion list. Its generic type match the type of
the items passed as SuggestionOptions.suggestions
to the
constructor.
A new FancySearch can be created using the constructor or one of the static factories below. In all cases, some means of accessing an input element must be provided, but all other options may be omitted.
Apart from the constructor and factories, no public methods exist on this
class. It does provide public access to its Suggestions
in the form of:
myFancySearch.list;
new (el:InputElement, ?options:FancySearchOptions<T>)
The constructor requires an input element which will be converted into a fancy search input (with appropriate event handlers bound to it). All other options are not required, but they allow you to modify the behavior of both the search input and the suggestion list.
staticcreateFromContainer<T> (container:Element, options:FancySearchOptions<T>):Search<T>
This static method creates and returns a new FancySearch given a container
element surrounding the input that will be used for your FancySearch. This
assumes that the container has exactly one input
child.
staticcreateFromSelector<T> (selector:String, options:FancySearchOptions<T>):Search<T>
This static method creates and returns a new FancySearch given a CSS-style selector string. This is convenient if you have no other references to the input element in your code.