Home

# Class goog.ui.ComboBox

A ComboBox control.

extends goog.ui.Component

Instance Method Summary
| `addItem(?goog.ui.MenuItem item)` Adds a new menu item at the end of the menu.
| `addItemAt(?goog.ui.MenuItem item, number n)` Adds a new menu item at a specific index in the menu.
| `canDecorate() ⇒ boolean` Combo box currently can't decorate elements.
| `clearDismissTimer_()` Clears the dismiss timer if it's active.
| `createDom()` Create the DOM objects needed for the combo box. A span and text input.
| `dismiss()` Dismisses the menu and resets the value of the edit field.
| `disposeInternal()` Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.
| `enterDocument()` Called when the component's element is known to be in the document. Anything using document.getElementById etc. should be done at this stage. If the component contains child components, this call is propagated to its children.
| `exitDocument()` Called by dispose to clean up the elements and listeners created by a component, or by a parent component/application who has removed the component from the document but wants to reuse it later. If the component contains child components, this call is propagated to its children. It should be possible for the component to be rendered again once this method has been called.
| `getDefaultText() ⇒ string`
| `getFieldName() ⇒ string`
| `getItemAt(number n) ⇒ ?goog.ui.MenuItem` Returns a reference to the menu item at a given index.
| `getItemCount() ⇒ number` Returns the number of items in the list, including non-visible items, such as separators.
| `getMatchFunction() ⇒ ?Function`
| `getMenu() ⇒ ?goog.ui.Menu`
| `getNumberOfVisibleItems_() ⇒ number`
| `getToken() ⇒ string`
| `getTokenText_() ⇒ string`
| `getValue() ⇒ string`
| `handleInputChange_()` Handles the content of the input box changing, either because of user interaction or programmatic changes.
| `handleKeyEvent(?goog.events.KeyEvent e) ⇒ boolean` Handles keyboard events from the input box. Returns true if the combo box was able to handle the event, false otherwise.
| `hideMenu_()` Hide the menu and remove the active class from the combo box's element.
| `isItemSticky_(?goog.ui.MenuItem item) ⇒ boolean` Returns true if the item has an isSticky method and the method returns true.
| `maybeShowMenu_(boolean showAll)` Shows the menu if it isn't already showing. Also positions the menu correctly, resets the menu item visibilities and highlights the relevent item.
| `onComboMouseDown_(?goog.events.BrowserEvent e)` Event handler for when the combo box area has been clicked.
| `onDocClicked_(?goog.events.BrowserEvent e)` Event handler for when the document is clicked.
| `onInputBlur_(?goog.events.BrowserEvent e)` Event handler for when the input box looses focus -- hide the menu
| `onInputEvent_(?goog.events.Event e)` Handles the content of the input box changing.
| `onMenuSelected_(?goog.events.Event e)` Handle the menu's select event.
| `positionMenu()` Positions the menu.
| `removeAllItems()` Remove all of the items from the ComboBox menu
| `removeItem(?goog.ui.MenuItem item)` Removes an item from the menu and disposes it.
| `removeItemAt(number n)` Removes a menu item at a given index in the menu.
| `setDefaultText(string text)` Sets the default text for the combo box.
| `setEnabled(boolean enabled)` Enables/Disables the combo box.
| `setFieldName(string fieldName)` Sets the field name for the combo box.
| `setItemHighlightFromToken_(string token)` Highlights the first token that matches the given token.
| `setItemVisibilityFromToken_(string token)` Loops through all menu items setting their visibility according to a token.
| `setMatchFunction(?Function matchFunction)` Sets the match function to be used when filtering the combo box menu.
| `setUseDropdownArrow(boolean useDropdownArrow)` Set to true if a unicode inverted triangle should be displayed in the dropdown button. This option defaults to false for backwards compatibility.
| `setValue(string value)` Sets the current value of the combo box.
| `setupMenu_()`
| `showMenu_()` Show the menu and add an active class to the combo box's element.