goog.ui.ac.AutoComplete
Classgoog.ui.ac.AutoComplete
> goog.events.EventTarget
> goog.Disposable
goog.ui.ac.AutoComplete(matcher, renderer, selectionHandler)
This is the central manager class for an AutoComplete instance.
matcher
{Object
}
requestMatchingRows(token, maxMatches, matchCallback)
.
renderer
{goog.events.EventTarget
}
isVisible():boolean
renderRows(rows:Array, token:string, target:Element);
hiliteId(row-id:number);
dismiss();
dispose():
.
selectionHandler
{Object
}
selectRow(row);
update(opt_force);
.
goog.ui.ac.AutoComplete.EventType
EnumEvents associated with the autocomplete … more
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
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. Supported for legacy but use goog.events.listen(src, type, handler) instead.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.attachInputWithAnchor(inputElement, anchorElement)
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.
inputElement
{Element
}
anchorElement
{Element
}
.attachInputs(var_args)
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.
var_args
{...Element
}
.cancelDelayedDismiss()
Cancel the active delayed dismiss if there is one.
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.detachInputs(var_args)
Detach text areas or input boxes to the autocomplete by DOM reference.
var_args
{...Element
}
.dismiss()
Clears out the token, rows, and hilite, and calls
renderer.dismiss()
.dismissOnDelay()
Call a dismiss after a delay, if there's already a dismiss active, ignore.
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
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.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Unattach 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, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass };
.firstRowId_
[protected] {number
}Id of the first row in autocomplete menu. Note that new ids are assigned everytime new suggestions are fetched.
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getIndexOfId(id)
[protected]Gets the index corresponding to a particular id.
id
{number
}
number
}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getRenderer()
Returns the renderer that renders/shows/highlights/hides the autocomplete menu.
goog.events.EventTarget
}
.getRowCount()
number
}
.getTarget()
Gets the current target HTML node for displaying autocomplete UI.
Element
}
.handleEvent(e)
Generic event handler that handles any events this object is listening to.
e
{goog.events.Event
}
.hasHighlight()
Returns whether or not the autocomplete is open and has a highlighted row.
boolean
}
.hiliteId(id)
Hilites the id if it's valid, otherwise does nothing.
id
{number
}
boolean
}
.hiliteId_
[protected] {number
}Id of the currently highlighted row.
.hiliteIndex(index)
Hilites the index, if it's valid, otherwise does nothing.
index
{number
}
boolean
}
.hiliteNext()
Moves the hilite to the next row, or does nothing if we're already at the end of the current set of matches. Calls renderer.hiliteId() when there's something to do.
boolean
}
.hilitePrev()
Moves the hilite to the previous row, or does nothing if we're already at the beginning of the current set of matches. Calls renderer.hiliteId() when there's something to do.
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isOpen()
boolean
}
.matcher_
[protected] {Object
}A data-source which provides autocomplete suggestions.
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
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.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.renderRows(rows, opt_options)
Renders the rows and adds highlighting.
rows
{!Array
}
opt_options
{(boolean
|goog.ui.ac.RenderOptions
)=}
.renderer_
[protected] {goog.events.EventTarget
}A renderer to render/show/highlight/hide the autocomplete menu.
.rows_
[protected] {Array
}Autcomplete suggestion items.
.selectHilited()
If there are any current matches, this passes the hilited row data to
selectionHandler.selectRow()
boolean
}
.selectionHandler_
[protected] {Object
}A handler which interacts with the input DOM element (textfield, textarea, or richedit).
.setAllowFreeSelect(allowFreeSelect)
Sets whether or not the up/down arrow can unhilite all rows.
allowFreeSelect
{boolean
}
.setAutoHilite(autoHilite)
Sets whether or not the first row should be highlighted by default.
autoHilite
{boolean
}
.setMaxMatches(max)
Sets the max number of matches to fetch from the Matcher.
max
{number
}
.setParentEventTarget(parent)
Inherited from goog.events.EventTarget
.
Sets the parent of this event target to use for bubbling.
parent
{goog.events.EventTarget
?}
.setTarget(target)
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()
target
{Element
}
.setToken(token, opt_fullString)
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()
.
token
{string
}
opt_fullString
{string
=}
.setTriggerSuggestionsOnUpdate(triggerSuggestionsOnUpdate)
Sets whether or not to request new suggestions immediately after completion of a suggestion.
triggerSuggestionsOnUpdate
{boolean
}
.setWrap(wrap)
Sets whether or not selections can wrap around the edges.
wrap
{boolean
}
.target_
[protected] {Element
}The target HTML node for displaying.
.token_
[protected] {?string
}Currently typed token which will be used for completion.
.update(opt_force)
Forces an update of the display.
opt_force
{boolean
=}