(Quick Reference)

comboBox

Purpose

Adds a ComboBox field to the parent container.

Examples

// Within a form
<v:form bean="${zooInstance}">
  <v:comboBox name="animal" from="${['Lion', 'Tiger', 'Snake']}">Animal</v:comboBox>
</v:form>

// Standalone <v:comboBox>My Combo Box</v:comboBox>

Description

The comboBox tag is a special type of field tag, where the field component is a Vaadin ComboBox.

Body

  • Contains the caption for the field

Attributes

Specific
  • name (optional) The property name of the field
  • caption (optional) The caption of the field. Overrides the body content.
  • from (optional) The data to use as containerDataSource. Either a comma-separated String, a collection of objects or a Vaadin Container.
  • itemIds (optional) Override the default itemIds. Either a comma-separated String or a collection of objects.
  • itemId (optional) Override the default itemId for each item. Either a closure that takes an Item parameter and returns an id, or the name of a property of the underlying bean.
  • itemCaption (optional) Override the default itemCaption for each item. Either a closure that takes an Item parameter and returns a caption, or the name of a property of the underlying bean.
  • itemCaptionMessagePrefix (optional) Obtain the itemCaption using i18n. Mimics Grails's valueMessagePrefix attribute. The specified value will be prepended (plus a dot '.') to the itemCaption, and the resulting string will be used for an i18n lookup. If this fails, the itemCaption is left unchanged.
  • itemIcon (optional) Display an icon for each item. Either a closure that takes an Item parameter and returns an icon, or the name of a property of the underlying bean.
    The resulting value should be a Vaadin Resource, or a String path to the resource. If the path starts with / or contains ://, it is treated as a URL; otherwise, it is treated as a path relative to the directory of the Vaadin application's active theme.
  • itemEquals (optional) Special case for handling Grails domain objects as item ids. Grails domain classes do not by default implement equals(), therefore cannot be used reliably as property types for Vaadin Select components. This attribute allows you to specify the property name that uniquely identifies both an item id and the underlying dataSource's value. Typically, you will use itemEquals="id".
  • onValueChange (optional) Either a ValueChangeListener or a Closure that takes a ValueChangeEvent parameter.

Remember to set immediate="true" if you want the ValueChangeEvent to fire immediately when the user selects a new value.

General
  • var (optional) Uses Grails's set tag to set the value of the specified variable to be this component.
  • class (optional) The CSS class name to add to the component using the addStyleName() method
  • sizeUndefined (optional) Calls setSizeUndefined() on the component. (Attribute value is ignored)
  • sizeFull (optional) Calls setSizeFull() on the component. (Attribute value is ignored)

See Vaadin ComboBox API docs for full list of allowed attributes.