goog.ui.ac.RichRemote
Provided By | |
---|---|
Extends | |
All Implemented Interfaces |
Factory class to create a rich autocomplete widget that autocompletes an inputbox or textarea from data provided via ajax. The server returns a complex data structure that is used with client-side javascript functions to render the results.
new RichRemote( url, input, opt_multi, opt_useSimilar )
Parameters |
|
---|
Instance Methods
this.addEventListener( type, handler, opt_capture, opt_handlerScope ) → void
void
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched.
warning Deprecated | Use |
---|
Defined by | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.addOnDisposeCallback<T>( callback, opt_scope ) → void
void
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added. If a callback is added to an already disposed Disposable, it will be called immediately.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.attachInputWithAnchor( inputElement, anchorElement ) → void
void
Attaches the autocompleter to a text area or text input element with an anchor element. The anchor element is the element the autocomplete box will be positioned against.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.attachInputs( ...var_args ) → void
void
Attach text areas or input boxes to the autocomplete by DOM reference. After elements are attached to the autocomplete, when a user types they will see the autocomplete drop down.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.cancelDelayedDismiss() → void
void
Cancel the active delayed dismiss if there is one.
this.detachInputs( ...var_args ) → void
void
Detach text areas or input boxes to the autocomplete by DOM reference.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.dismiss() → void
void
Clears out the token, rows, and hilite, and calls
renderer.dismiss()
this.dismissOnDelay() → void
void
Call a dismiss after a delay, if there's already a dismiss active, ignore.
this.dispatchEvent( e ) → boolean
boolean
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object.
If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.dispose() → ?
?
Disposes of the object and its resources.
Overrides | ||
---|---|---|
Specified by | ||
Parameters | None. | |
Returns |
|
this.disposeInternal() → void
void
Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.
Defined by | |
---|---|
Overrides | |
Parameters | None. |
this.fireListeners<EVENTOBJ>( type, capture, eventObject ) → boolean
boolean
Fires all registered listeners in this listenable for the given type and capture mode, passing them the given eventObject. This does not perform actual capture/bubble. Only implementors of the interface should be using this.
Overrides | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||
Parameters |
| ||||||||||||
Returns |
|
this.getAllSuggestions() → Array<?>
Array<?>
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getDisposed() → boolean
boolean
warning Deprecated | Use |
---|
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getHighlightedId() → number
number
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getIndexOfId( id ) → number
number
this.getInputHandler() → (goog.ui.ac.InputHandler|null)
(goog.ui.ac.InputHandler|null)
Gets the attached InputHandler object.
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getListener<SCOPE, EVENTOBJ>( type, listener, capture, opt_listenerScope ) → (goog.events.ListenableKey|null)
(goog.events.ListenableKey|null)
Gets the goog.events.ListenableKey for the event or null if no such listener is in use.
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.getListeners<EVENTOBJ>( type, capture ) → Array<goog.events.ListenableKey>
Array<goog.events.ListenableKey>
Gets all listeners in this listenable for the given type and capture mode.
Overrides | |||||||||
---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||
Parameters |
| ||||||||
Returns |
|
this.getMatcher() → Object
Object
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getParentEventTarget() → (goog.events.Listenable|null)
(goog.events.Listenable|null)
Returns the parent of this event target to use for capture/bubble mechanism.
NOTE(chrishenry): The name reflects the original implementation of
custom event target (goog.events.EventTarget
). We decided
that changing the name is not worth it.
Overrides | |||
---|---|---|---|
Specified by | |||
Parameters | None. | ||
Returns |
|
this.getRenderer() → (goog.events.EventTarget|null)
(goog.events.EventTarget|null)
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getRowCount() → number
number
warning Deprecated | Use this.getSuggestionCount(). |
---|
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getSelectionHandler() → Object
Object
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getSuggestion( index ) → (Object|null)
(Object|null)
this.getSuggestionCount() → number
number
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getTarget() → (Element|null)
(Element|null)
Gets the current target HTML node for displaying autocomplete UI.
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.getToken() → (string|null)
(string|null)
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.handleEvent( e ) → void
void
Generic event handler that handles any events this object is listening to.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.hasHighlight() → boolean
boolean
Returns whether or not the autocomplete is open and has a highlighted row.
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.hasListener<EVENTOBJ>( opt_type, opt_capture ) → boolean
boolean
Whether there is any active listeners matching the specified signature. If either the type or capture parameters are unspecified, the function will match on the remaining criteria.
Overrides | |||||||||
---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||
Parameters |
| ||||||||
Returns |
|
this.hiliteId( id ) → boolean
boolean
this.hiliteIndex( index ) → boolean
boolean
this.hiliteNext() → boolean
boolean
Moves the hilite to the next non-disabled row. Calls renderer.hiliteId() when there's something to do.
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.hilitePrev() → boolean
boolean
Moves the hilite to the previous non-disabled row. Calls renderer.hiliteId() when there's something to do.
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.isDisposed() → boolean
boolean
Overrides | |||
---|---|---|---|
Specified by | |||
Parameters | None. | ||
Returns |
|
this.isOpen() → boolean
boolean
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.listen<SCOPE, EVENTOBJ>( type, listener, opt_useCapture, opt_listenerScope ) → goog.events.ListenableKey
goog.events.ListenableKey
Adds an event listener. A listener can only be added once to an object and if it is added again the key for the listener is returned. Note that if the existing listener is a one-off listener (registered via listenOnce), it will no longer be a one-off listener after a call to listen().
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.listenOnce<SCOPE, EVENTOBJ>( type, listener, opt_useCapture, opt_listenerScope ) → goog.events.ListenableKey
goog.events.ListenableKey
Adds an event listener that is removed automatically after the listener fired once.
If an existing listener already exists, listenOnce will do nothing. In particular, if the listener was previously registered via listen(), listenOnce() will not turn the listener into a one-off listener. Similarly, if there is already an existing one-off listener, listenOnce does not modify the listeners (it is still a once listener).
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.registerDisposable( disposable ) → void
void
Associates a disposable object with this object so that they will be disposed together.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.removeAllListeners( opt_type ) → number
number
Removes all listeners from this listenable. If type is specified, it will only remove listeners of the particular type. otherwise all registered listeners will be removed.
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.removeEventListener( type, handler, opt_capture, opt_handlerScope ) → void
void
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
warning Deprecated | Use |
---|
Defined by | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.renderRows( rows, opt_options ) → void
void
Renders the rows and adds highlighting.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.selectHilited() → boolean
boolean
If there are any current matches, this passes the hilited row data to
selectionHandler.selectRow()
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.setAllowFreeSelect( allowFreeSelect ) → void
void
Sets whether or not the up/down arrow can unhilite all rows.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setAutoHilite( autoHilite ) → void
void
Sets whether or not the first row should be highlighted by default.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setContent( content ) → void
void
Set the post data for the matcher.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setHeaders( headers ) → void
void
Set the HTTP headers for the matcher.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setMatcher( matcher ) → void
void
Sets the data source providing the autocomplete suggestions.
See constructor documentation for the interface.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setMaxMatches( max ) → void
void
Sets the max number of matches to fetch from the Matcher.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setMethod( method ) → void
void
Set the send method ("GET", "POST") for the matcher.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setParentEventTarget( parent ) → void
void
Sets the parent of this event target to use for capture/bubble mechanism.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setRenderer( renderer ) → void
void
Sets the renderer that renders/shows/highlights/hides the autocomplete menu.
See constructor documentation for the expected renderer API.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setRowBuilder( rowBuilder ) → void
void
Sets the function building the rows.
Parameters |
|
---|
this.setRowFilter( rowFilter ) → void
void
Set the filter that is called before the array matches are returned.
Parameters |
|
---|
this.setTarget( target ) → void
void
Sets the current target HTML node for displaying autocomplete UI.
Can be an implementation specific definition of how to display UI in relation
to the target node.
This target will be passed into renderer.renderRows()
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setTargetForTesting( target ) → void
void
Sets the target to be used for event.target
when firing
event. Mainly used for testing. For example, see
goog.testing.events.mixinListenable
.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setTimeoutInterval( interval ) → void
void
Set the timeout interval for the matcher.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setToken( token, opt_fullString ) → void
void
Sets the token to match against. This triggers calls to the Matcher to
fetch the matches (up to maxMatches), and then it triggers a call to
renderer.renderRows()
.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.setTokenInternal( token ) → void
void
Sets the current token (without changing the rendered autocompletion).
NOTE(chrishenry): This method will likely go away when we figure out a better API.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setTriggerSuggestionsOnUpdate( triggerSuggestionsOnUpdate ) → void
void
Sets whether or not to request new suggestions immediately after completion of a suggestion.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setUseStandardHighlighting( useStandardHighlighting ) → void
void
Set whether or not standard highlighting should be used when rendering rows.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.setWrap( wrap ) → void
void
Sets whether or not selections can wrap around the edges.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.unlisten<SCOPE, EVENTOBJ>( type, listener, opt_useCapture, opt_listenerScope ) → boolean
boolean
Removes an event listener which was added with listen() or listenOnce().
Overrides | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Specified by | |||||||||||||||||
Parameters |
| ||||||||||||||||
Returns |
|
this.unlistenByKey( key ) → boolean
boolean
Removes an event listener which was added with listen() by the key returned by listen().
Overrides | |||||
---|---|---|---|---|---|
Specified by | |||||
Parameters |
| ||||
Returns |
|
this.update( opt_force ) → void
void
Forces an update of the display.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
Instance Properties
this.creationStack → (string|undefined)
(string|undefined)
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
this.firstRowId_ → number
number
Id of the first row in autocomplete menu. Note that new ids are assigned every time new suggestions are fetched.
TODO(chrishenry): Figure out what subclass does with this value and whether we should expose a more proper API.
this.hiliteId_ → number
number
Id of the currently highlighted row.
this.matcher_ → (Object|null)
(Object|null)
A data-source which provides autocomplete suggestions.
TODO(chrishenry): Tighten the type to !goog.ui.ac.AutoComplete.Matcher.
this.renderer_ → (goog.events.EventTarget|null)
(goog.events.EventTarget|null)
A renderer to render/show/highlight/hide the autocomplete menu.
this.rows_ → (Array<?>|null)
(Array<?>|null)
Autocomplete suggestion items.
this.selectionHandler_ → (Object|null)
(Object|null)
A handler which interacts with the input DOM element (textfield, textarea, or richedit).
TODO(chrishenry): Tighten the type to !Object.
this.target_ → (Element|null)
(Element|null)
The target HTML node for displaying.
this.token_ → (string|null)
(string|null)
Currently typed token which will be used for completion.