Изменения

SimpleAutocomplete/en

1072 байта добавлено, 18:18, 5 марта 2013
м
Нет описания правки
; input: The input, either id or DOM element reference (the input must have an id anyway).
; dataLoader(hint, value[, more]): Callback which should load autocomplete options and then call <tt>hint.replaceItems(newOptions, append);</tt>, where:: newOptions = [ [ name, value , disabled, checked ] ], [ name, value ], ... ])</tt::: name = HTML option name::: value = plaintext option value::: disabled = only meaningful when multipleListener is set::: checked = only meaningful when multipleListener is set:: append = (more>. '0): Callback parameters::; hint' parameter will be this autocompleter : This SimpleAutocomplete object, and the :; value: The string guess should be done based on :; more: The 'valuepage' parameter (string)of autocomplete options to load, 0 = first page. See also moreMarker option below.
Optional constructor parameters are passed as keys of the 'params' object:
; multipleDelimiter: Pass a delimiter string (for example ',' or ';') to enable multiple selection. Item values cannot have leading or trailing whitespace. Input value will consist of selected item values separated by this delimiter plus single space. dataLoader should handle it's 'value' parameter accordingly in this case, because it will be just the raw value of the input, probably with incomplete item or items, typed by the user.
; multipleListener(hint, index, item): If you don't want to touch the input value, but want to use multi-select for your own purposes, specify a callback that will handle item clicks here. Also you can disable and check/uncheck items during loading in this mode.; onChangeListener(hint, index): Callback which is called when input value is changed using this dropdown. <tt>index</tt> is the number of element which selection is changed, starting with 0. It must be used instead of normal 'onchange' event.; maxHeight: Maximum hint dropdown height in pixels; emptyText: Text to show when dataLoader returns no options. If emptyText === false, the Empty (default) means 'hide hint will be hidden instead of showing text'.; allowHTML: If true, HTML code will be allowed in option names.; prompt: HTML text to be displayed before a non-empty option list. Empty by default.; delay: If this is set to a non-zero value, the autocompleter does no more than 1 request in each delay milliseconds.; moreMarker: The server supplying hint options usually limits their count. But it's not always convenient having to type additional characters to narrow down the selection. Optionally you can supply additional item with special value equal to moreMarker value or '#MORE' at the end of the list, and SimpleAutocomplete will issue another request to dataLoader with incremented 'more' parameter when it will be clicked. You can also set moreMarker to false to disable this feature.
When you don't need SimpleAutocomplete instance any more, you can destroy it with: