The goog.ui.ac.Renderer Class

goog.ui.ac.Renderer
> goog.events.EventTarget
> goog.Disposable

goog.ui.ac.Renderer(opt_parentNode, opt_customRenderer, opt_rightAlign, opt_useStandardHighlighting)

Class for rendering the results of an auto-complete in a drop down list.

opt_parentNode {Element=}
optional reference to the parent element that will hold the autocomplete elements. goog.dom.getDocument().body will be used if this is null.
opt_customRenderer {?({renderRow}|{render})=}
Custom full renderer to render each row. Should be something with a renderRow or render method.
opt_rightAlign {boolean=}
Determines if the autocomplete will always be right aligned. False by default.
opt_useStandardHighlighting {boolean=}
Determines if standard highlighting should be applied to each row of data. Standard highlighting bolds every matching substring for a given token in each row.

The goog.ui.ac.Renderer.CustomRenderer Class

Class allowing different implementations to custom render the autocomplete. Extending classes should override the render function. … more

.DELAY_BEFORE_MOUSEOVER {number}

The delay before mouseover events are registered, in milliseconds

@const

.activeClassName {string}

Class name for active row div. Active row will have rowClassName & activeClassName & legacyActiveClassName.

.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}
The type of the event to listen for.
handler {Function|Object}
The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.
opt_capture {boolean=}
In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.
opt_handlerScope {Object=}
Object in whose scope to call the listener.

.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}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.animation_ {goog.fx.Animation|undefined}

Animation in progress, if any.

.className {string}

Classname for the main element

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dismiss()

Hide the object.

.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}
Event object.
returns {boolean}
If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.

.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.

returns {void}
Nothing.

.getElement()

Gets the renderer's element.

returns {Element}
The main element that controls the rendered autocomplete.

.getParentEventTarget()

Inherited from goog.events.EventTarget .

Returns the parent of this event target to use for bubbling.

returns {goog.events.EventTarget}
The parent EventTarget or null if there is no parent.

.highlightedClassName {string}

Class name for the bold tag highlighting the matched part of the text.

.hiliteId(id)

Sets the 'active' class of the item with a given id.

id {number}
Id of the row to hilight. If id is -1 then no rows get hilited.

.hiliteNone()

Removes the 'active' class from the currently selected row.

.hiliteRow(index)

Sets the 'active' class of the nth item.

index {number}
Index of the item to highlight.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.isVisible()

returns {boolean}
True if the object is visible.

.redraw()

Redraw (or draw if this is the first call) the rendered auto-complete drop down.

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.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}
The type of the event to listen for.
handler {Function|Object}
The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.
opt_capture {boolean=}
In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.
opt_handlerScope {Object=}
Object in whose scope to call the listener.

.renderRowHtml(row, token)

Render a row by creating a div and then calling row rendering callback or default row handler

row {Object}
Object representing row.
token {string}
Token to highlight.
returns {Element}
An element with the rendered HTML.

.renderRows(rows, token, opt_target)

Render the autocomplete UI

rows {Array}
Matching UI rows.
token {string}
Token we are currently matching against.
opt_target {Element=}
Current HTML node, will position popup beneath this node.

.reposition()

Repositions the auto complete popup relative to the location node, if it exists and the auto position has been set.

.rowClassName {string}

Classname for row divs

.setAnchorElement(anchor)

Sets the anchor element for the subsequent call to renderRows.

anchor {Element}
The anchor element.

.setAutoPosition(auto)

Sets whether the renderer should try to determine where to position the drop down.

auto {boolean}
Whether to autoposition the drop down.

.setHighlightAllTokens(highlightAllTokens)

Set whether or not to highlight all matching tokens rather than just the first.

highlightAllTokens {boolean}
Whether to highlight all matching tokens rather than just the first.

.setMenuFadeDuration(duration)

Sets the duration (in msec) of the fade animation when menu is shown/hidden. Setting to 0 (default) disables animation entirely.

duration {number}
Duration (in msec) of the fade animation (or 0 for no animation).

.setParentEventTarget(parent)

Inherited from goog.events.EventTarget .

Sets the parent of this event target to use for bubbling.

parent {goog.events.EventTarget?}
Parent EventTarget (null if none).

.setRightAlign(align)

Set whether to align autocomplete to the right of the target element.

align {boolean}
If true, align to right.

.setTopAlign(align)

Set whether to align autocomplete to top of target element

align {boolean}
If true, align to top.

.setUseStandardHighlighting(useStandardHighlighting)

Set whether or not standard highlighting should be used when rendering rows.

useStandardHighlighting {boolean}
true if standard highlighting used.

.setWidthProvider(widthProvider)

Sets the width provider element. The provider is only used on redraw and as such will not automatically update on resize.

widthProvider {Node}
The element whose width should be mirrored.

.show()

Show the object.