Column definition

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

This column definition is part of the Magnolia 6 UI framework. The fully qualified class name is info.magnolia.ui.contentapp.configuration.column.ColumnDefinition.

If you work with the Magnolia 5 UI framework, see Column definition for Magnolia 5 UI instead.

Example definitions

Simple column definitions

  • Title column

  • Date column

jcrName:
  $type: jcrTitleColumn
  nodeTypeToIcon:
    mgnl:page: icon-file-webpage
mgnl:lastModified:
  $type: dateColumn

Columns with filter definitions

  • With a default filter value

  • With a checkbox filter

columns:
  value:
    filterComponent:
      $type: textField
      defaultValue: 10
columns:
  mgnl:activationStatus:
    $type: columnComponent
    type: java.lang.Boolean
    editor:
      field:
        $type: checkBoxField
    filterComponent:
      $type: checkBoxField
      defaultValue: true

Columns with combobox filters and datasource definitions

  • With an enumeration

  • With options

  • With a list of JCR nodes

columns:
  layout:
    filterComponent:
      $type: comboBoxField
      emptySelectionAllowed: true
      datasource:
        $type: enumDatasource
        enumeration: info.magnolia.ui.field.Layout
columns:
  isFeatured:
    filterComponent:
      $type: comboBoxField
      emptySelectionAllowed: true
      datasource:
        $type: optionListDatasource
        options:
          - name: true
            value: true
            label: Featured
columns:
  destination:
    filterComponent:
      $type: comboBoxField
      emptySelectionAllowed: true
      datasource:
        $type: jcrDatasource
        rootPath: /destinations
        workspace: category

Column properties

Property Description

class

required (unless $type is used)

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. See Column types for possible values.

$type

You can use this as a shortcut for class if the definition class is annotated with info.magnolia.ui.contentapp.configuration.column.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 definitions.

type

required, default is java.lang.String

Data type of the column. Use the fully qualified class name. See PropertyType for possible values.

A default type is typically hard-coded in each definition class. You only need to add this property if you want to override the default implementation.

Make sure that type is set to a value that matches the type of data you entered (for example, java.lang.Long for long values).

name

optional, default is parent node name

Name of the column.

label

optional

Text displayed in the column heading. The value can be literal or a key of a message bundle.

If you do not provide the property, Magnolia will fall back to a generated i18n key.

descriptionGenerator

optional

Generates a description for the column.

editable

optional, default is false

When true, the column can be edited inline. You can double-click a cell to edit its value.

You cannot define defaultAction and use inline editing at the same time.

editor

optional

Defines the inline editor component. For this to work, you have to set editable to true. See the ColumnEditorDefinition interface.

     field

required, default is textField

Type of the field definition item. See Field types for possible values.

     availability

optional

Outlines when inline editing is permitted. See Action availability for more information.

Availability is resolved against the selected row, not the selected column or property.

filterComponent

optional

Adds a filter field to the column. Only text, checkbox and combobox fields are supported (see Example definitions). The default value and converter of combobox field are not supported.

A node identifier is applied to filtering if the field value is javax.jcr.Node. That is, if the destination column in Example definitions is configured with jcrDatasource, the combobox field options will be populated with javax.jcr.Node.

Column filtering is not supported in REST-based elements of the UI.

expandRatio

optional

Defines the ratio with which the column expands. By default, all columns expand equally.

maximumWidth

optional

Defines the maximum allowed pixel width of the column when it is set to expand.

minimumWidth

optional

Defines the minimum guaranteed pixel width of the column when it is set to expand.

minimumWidthFromContent

optional, default is true

Sets whether the width of the content in the column is the minimum width of the column. When false, the column shrinks down to the width defined in minimumWidth if necessary.

width

optional

Defines the width (in pixels). When set, overrides any configuration from expandRatio, maximumWidth and minimumWidth.

sortable

optional, default is true

When false, the column cannot be sorted.

renderer

optional, default is com.vaadin.ui.renderers.TextRenderer

Class extending Vaadin AbstractRenderer.

com.vaadin.ui.renderers.ComponentRenderer is used by columnComponent. info.magnolia.ui.contentapp.configuration.column.renderer.DefaultDateRenderer is used by dateColumn.

valueProvider

optional

Class extending Vaadin ValueProvider.

We don’t recommend configuring type, renderer and valueProvider through YAML. This will not be possible in future major versions.

Rather, create a custom column definition instead to prevent misconfiguration errors such as configuring a correct renderer but a wrong type:

public class ProgressColumnDefinition<T> extends ConfiguredColumnDefinition {
    public ProgressColumnDefinition() {
        setType(Double.class);
        setRenderer(ProgressBarRenderer.class);
    }
}
columns:
  scale:
    class: my.package.ProgressColumnDefinition

Column types

$type class

dateColumn

info.magnolia.ui.contentapp.configuration.column.DateColumnDefinition

iconColumn

info.magnolia.ui.contentapp.configuration.column.icon.IconColumnDefinition

iconAndValueColumn

info.magnolia.ui.contentapp.configuration.column.icon.IconAndValueColumnDefinition

columnComponent

info.magnolia.ui.contentapp.configuration.column.component.ColumnComponentDefinition

jcrPathColumn

info.magnolia.ui.contentapp.column.jcr.JcrPathColumnDefinition

jcrStatusColumn

info.magnolia.ui.contentapp.column.jcr.JcrStatusColumnDefinition

jcrTitleColumn

info.magnolia.ui.contentapp.column.jcr.JcrTitleColumnDefinition

N/A

info.magnolia.ui.contentapp.configuration.column.AbstractSafeHtmlColumnDefinition

Extend this class to implement a column with HTML support. The developer is responsible for escaping of external content by extending info.magnolia.ui.contentapp.configuration.column.AbstractSafeHtmlColumnDefinition.AbstractValueProvider and using its escapeHtml method.

Feedback