Page tree
Skip to end of metadata
Go to start of metadata

AbstractSelectFieldDefinition is a base definition class for various types of select fields. It specifies the type of data to populate the selection components and the type of data source used by the select field.

This select field definition is part of the Magnolia 6 UI framework. Use any of the following concrete implementations:

  • info.magnolia.ui.field.ComboBoxFieldDefinition
    • info.magnolia.rest.ui.field.comboboxfield.JsonComboBoxFieldDefinition
  • info.magnolia.ui.field.ListSelectFieldDefinition
  • info.magnolia.ui.field.TwinColSelectFieldDefinition

If you work with the Magnolia 5 UI framework, see Select field for Magnolia 5 UI instead.

Select field properties

datasource

required

Connects the field to a data source. Options are populated via the configured data source.

Use the fully qualified class name or the $type alias if the definition class is annotated with info.magnolia.ui.datasource.DatasourceType.

filteringMode

optional, default is OFF (STARTSWITH in link field)

Vaadin FilteringMode. Available values are CONTAINS and STARTSWITH.

For this to work, you have to set the textInputAllowed property of combobox field to true.

See also Common field properties.

Combobox field

ComboBoxFieldDefinition renders a dropdown option list where only one item can be selected. The component has a text field where items can be filtered based on user input.

Example definition

comboSelect:
  label: Prefix
  $type: comboBoxField
  datasource:
    $type: optionListDatasource
    options:
      - name: mr
        label: Mr.
        value: mr
      - name: mrs
        label: Mrs.
        value: mrs
      - name: miss
        label: Miss
        value: miss

(info) JsonComboBoxFieldDefinition is an alternative that wraps the comboBoxField type and shows an error if a JSON datasource is not available.

jcrName:
  label: Name
  $type: jsonComboBoxField
  datasource:
    name: rest
    $type: jsonDatasource
    restClient: countries
    restCall: allCountries
    jsonPathExpressions:
      itemId: '$.name'
      items: '$.*'
      describeBy: '$.name'

Field properties

emptySelectionAllowed

optional, default is false (true in link field)

Defines whether the user can select nothing in the field. When true, an empty item appears to the user.

emptySelectionCaption

optional, default is empty string

When emptySelectionAllowed is true, the empty item appears with the given caption. The value is i18n-able.

pageLength

optional, default is 0

To enable paging and filtering in the field pop-up, value must be an integer greater than 0. Value of 0 disables paging and filtering and makes all items visible.

popWidth

optional

Sets the width of the field pop-up relative to the field itself. If no value is specified, the pop-up's width will automatically expand to fit the content of all displayed items.

scrollToSelectedItem

optional

Defines whether the selected item is visible when opening the field pop-up. Available values are true and false.

textInputAllowed

optional, default is false (true in link field)

When true, the user can type into the field to filter the available items. The filteringMode property of select field defines how the options are filtered.

When false, the field just shows the current selection.

See also select field and common field properties.

List field

ListSelectFieldDefinition renders a list box where more than one item can be selected. If the number of items exceeds the height of the component, a scrollbar will appear.

Example definition

listSelect:
  label: Contacts
  $type: listSelectField
  datasource:
    $type: jcrDatasource
    workspace: contacts
    describeByProperty: firstName
    allowedNodeTypes:
      - mgnl:contact

Field properties

rows

optional, default is 4

Number of rows in the field. When set to 0, the actual number of rows is determined implicitly by the field.

See also select field and common field properties.

Twin-column field

TwinColSelectFieldDefinition renders two column lists where more than one item can be selected. The left column contains items available for selection, and the right column lists selected items. The component is useful for selecting large sets of items such as group and role memberships.

Example definition

twinSelect:
  label: Groups
  $type: twinColSelectField
  leftColumnCaption: "Available groups"
  rightColumnCaption: "User is member of"
  datasource:
    $type: jcrDatasource
    workspace: usergroups
    allowedNodeTypes:
      - mgnl:group

Field properties

leftColumnCaption

optional

Text displayed above the left column. Typically retrieved from a message bundle.

rightColumnCaption

optional

Text displayed above the right column. Typically retrieved from a message bundle.

See also select field and common field properties.

  • No labels