class
SAPO.Component.Autocomplete
Defined in
Component/Autocomplete/0.1/lib.js
Constructor Summary
Autocomplete
(Object
options)
Function Summary
setChosenText
(String
txt)
Set given text on the target input box
Constructor Details
constructor Autocomplete
Autocomplete(Object
options)
Parameters:
options
- component options -
[ String cssURI ]
- URI to alternate CSS file for styling the component -
String|Object textbox
- HTML input box from which text will be autocompleted -
String|Object target
- HTML element where the results will be shown -
String requestURI
- URI which will be used to fetch data -
String requestParams
- additional request parameters to be sent to the server -
[ Function searchCallBack ]
- optional local filter function to use instead of ajax -
[ String[] resultsBag ]
- used by searchCallBack. universe where the query gets done -
Function onSelectCallBack
- function called when an option is selected. gets the selected option as a parameter -
[ String requestVar ]
- name of the parameter which is sent to the server with the data to autocomplete (default is 'text') -
[ String classNameSelected ]
- classname applied to the selected item (default is 'selected') -
[ Number min ]
- minimum number of characters on the field for the autocomplete to be functional (default is 2) -
[ Number resultLimit ]
- maximum number of results displayed (default is 10) -
[ String responseKey ]
- JSON response key to look for the array of autocomplete strings (default is 'suggestions') -
[ Boolean allowNewValue ]
- if true, the current value appears as first autocomplete option (default is false)
Function Details
function setChosenText
setChosenText(String
txt)
Set given text on the target input box
Parameters:
txt
- text to be inserted
requires SAPO.Dom.Event
requires SAPO.Dom.Css
requires SAPO.Utility.String
requires SAPO.Communication.Ajax
Adds autocomplete behavior to a form input field