You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

Columns define what content is displayed in tree and list views in the browser subapp.

Example column definition

columns: &columns
  - name: jcrName
    label: name
    $type: jcrNameColumn
    editable: true
    nodeTypeToIcon:
      mgnl:contact: icon-people
      mgnl:content: icon-folder
    editor:
      availability:
        nodes: true
        properties: true
  - name: value
    label: value
    editable: true
    editor:
      availability:
        nodes: false
        properties: true
  - name: jcrPath
    label: path
    $type: jcrPathColumn
  - name: status
    label: status
    $type: jcrStatusColumn
  - name: mgnl:created
    $type: dateColumn
    label: date
    editable: false
    editor:
      availability: *onlyContacts
      field:
        $type: textField
        converterClass: com.vaadin.data.converter.StringToDateConverter

Column definition properties

class

required

The column definition class reads the column configuration and displays the column accordingly. The class must implement the ColumnDefinition interface. You can write your own class or use one of the ready-made classes. Set the value to the fully qualified class name. Examples:

  • AbstractColumnDefinition is the base implementation for all special column definitions.
  • PropertyColumnDefinition displays the value of a property.
  • PropertyTypeColumnDefinition displays the type of a property.
  • StatusColumnDefinition displays the activation status of an item.
  • MetaDataColumnDefinition displays the last modification date.

If the definition class is annotated with info.magnolia.ui.workbench.column.definition.ColumnType, you can use the $type property instead.

$type

You can use this as a shortcut for class if the definition class is annotated with info.magnolia.ui.workbench.column.definition.ColumnType. The proper value is defined by the annotation.

Example class annotation
@ColumnType("dateColumn")
public class DateColumnDefinition extends ConfiguredColumnDefinition<Date> {
...
}

To use the $type property in YAML, see Example column definition.

propertyName

required only when using PropertyColumnDefinition

Name of the property to display.

displayInChooseDialog

optional, default is true

Defines whether the column is displayed in a choose dialog.

enabled

optional, default is true

Defines whether the column is displayed in the workbench.

expandRatio

optional, default is 1.0

Defines how excess space is divided among columns. A table can have excess space if its width is defined and there is more horizontal space than is occupied by the column data. In a three-column workbench with expand ratios 22 and 1, the first column takes 40% of the horizontal space, the second column 40% and the third column 20%.

formatterClass

optional

Defines how the column's value is displayed in the UI. This is useful for making raw data more readable or adhering to a formatting convention.

The Contacts app implements ContactNameColumnFormatter, which concatenates the first name and last name of the contact person and displays them as full name in one column. So Vincent + Van Gogh is displayed as Vincent Van Gogh. Another example is to segment a phone number such as 41612289000 into +41 61 228 9000.

The formatter class must implement the ColumnFormatter interface. Set the value to the fully qualified class name.

label

optional, default is column name

Text displayed to use in the column heading. Can be the text itself or an 18n key.

name

optional, default is parent node name

Name of the column.

readOnly

optional, default is false

Defines whether the column is editable inline. You can double-click a cell to edit its value.

Defining a default action will override inline editing. Double-clicking the cell will trigger the default action instead of inline edit mode.

width

optional

Column width in pixels. Five pixels are used for the left margin. So when you define width as 60, you get 55 pixels of space. Set the value to a number without unit.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels