Home

Class goog.ui.AutoComplete.Renderer

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

extends goog.events.EventTarget
Instance Method Summary
dismiss()

Hide the object.

disposeInternal()

Disposes of the renderer and its associated HTML.

getElement() ⇒ ?Element

Gets the renderer's element.

getRowFromEventTarget_(?Element et) ⇒ number

Given an event target looks up through the parents till it finds a div. Once found it will then look to see if that is one of the childnodes, if it is then the index is returned, otherwise -1 is returned.

getTokenRegExp_((Array|null|string) tokenOrArray) ⇒ string

Transforms a token into a string ready to be put into the regular expression in hiliteMatchingText_.

handleClick_(?goog.events.Event e)

Handle the click events. These are redirected to the AutoComplete object which then makes a callback to select the correct row.

handleDocumentMousedown_(?Object e)

Handles the user clicking on the document.

handleMouseDown_(?goog.events.Event e)

Handle the mousedown event and tell the AC not to dimiss.

handleMouseOver_(?goog.events.Event e)

Handle the mousing events. These are redirected to the AutoComplete object which then makes a callback to set the correctly highlighted row. This is because the AutoComplete can move the focus as well, and there is no sense duplicating the code

hiliteId(number id)

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

hiliteMatchingText_(?Node node, (Array|null|string) tokenOrArray)

Goes through a node and all of its child nodes, replacing HTML text that matches a token with token.

hiliteNone()

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

hiliteRow(number index)

Sets the 'active' class of the nth item.

isVisible() ⇒ boolean
maybeCreateElement_()

If the main HTML element hasn't been made yet, creates it and appends it to the parent.

redraw()

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

renderRowContents_(?Object row, string token, ?Node node)

Generic function that takes a row and renders a DOM structure for that row. Normally this will only be matching a maximum of 20 or so items. Even with 40 rows, DOM this building is fine.

renderRowHtml(?Object row, string token) ⇒ ?Element

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

renderRows(?Array rows, string token, ?Element= opt_target)

Render the autocomplete UI

reposition()

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

setAnchorElement(?Element anchor)

Sets the anchor element for the subsequent call to renderRows.

setAutoPosition(boolean auto)

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

setHighlightAllTokens(boolean highlightAllTokens)

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

setMenuClasses_(?Element elt)

Sets CSS classes on autocomplete conatainer element.

setMenuFadeDuration(number duration)

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

setTopAlign(boolean align)

Set whether to align autocomplete to top of target element

setUseStandardHighlighting(boolean useStandardHighlighting)

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

setWidthProvider(?Node widthProvider)

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

show()

Show the object.