The group column of a row grouping: arrows, indentation and the group labels ("Nord (3)"). Created by RowGroupFactory.createTableModel; the column is sortable (by group key) and not editable. Its property is RowGroupColumnDef.PROPERTY – sort and state refer to it like to any column.

Example

const tableModel = RowGroupFactory.createTableModel<Sale>({ rows: sales, columnDefs, groupBy: ["region"] });
const groupColumn = tableModel.getColumnDefs()?.find(isRowGroupColumnDef);

Since

1.1.94

Hierarchy

Constructors

Properties

autoHeaderLabel: boolean

True if the header follows the grouping (no own headerLabel).

classes: AreaObjectMapType<string[]> = ...

CSS classes per area – classes.header, .body, .footer. The constants bodyLeft, allRight … are ready-made maps for the alignment.

editInputPipe?: editInputPipe

Converts the text of the editor before it is written into the model, e.g. editInputPipeForNumber.

editable?: BooleanFunction

The cells of this column can be edited (double-click or F2), e.g. TrueFn.

See

Training: Inline editing

formula?: string

The formula of a formula column, see ColumnDefIf.formula.

getEditRenderer?: GetEditRenderer

The editor of this column. Default: TableOptions.getEditRenderer (a text input, InputCellRenderer).

Example

getEditRenderer: () => new SelectCellRenderer(["open", "paid"].map(s => new ValueLabel(s, s)))
headerLabel: string

Text of the header cell (used when the header is built from the column definitions).

isVisible: BooleanFunction = ...

Whether the column is shown. Hidden columns are not rendered, copied or exported.

Example

ColumnDef.create({ property: "category", headerLabel: "Category", isVisible: FalseFn })
maxWidth: SizeIf = ...

Upper limit for percentage widths ("%"). Not applied to pixel widths or to resizing with the mouse.

minWidth: SizeIf = ...

Lower limit for percentage widths ("%"). Not applied to pixel widths or to resizing with the mouse.

The options with defaults.

property: string

Property of the row object shown in this column ("customer"). With nested objects a path like "address.city".

rendererMap: AreaObjectMapType<CellRendererIf> = ...

Cell renderers per area – rendererMap.header, .body, .footer. Without a renderer the value is shown as text.

Example

column.rendererMap.body = new NumberCellProgressBarCellRenderer(20, false);
column.rendererMap.footer = new EuroRenderer(); // an own CellRendererIf

See

Training: Cell renderers

Row drag: the body cells of this column get a drag handle (true, or a function that decides per row – e.g. no handle for locked rows). Dragging the handle moves the row (see TableOptionsIf.rowDragOptions); the keyboard alternative is Ctrl+Alt+↑/↓. TableFactory.createTableModel({ rows, rowDrag: true }) sets it on the first data column.

Example

ColumnDef.create({ property: "title", headerLabel: "Task", rowDrag: (task: { locked: boolean }) => !task.locked })

Since

1.1.95

showValuesAs?: ShowValuesAsConfig

„Show values as“, see ColumnDefIf.showValuesAs.

sortComparator?: ValueRowSortComparator

Own comparison of two cell values (and their rows), like for Array.prototype.sort.

Example

sortComparator: (a: string, b: string) => a.localeCompare(b, "de")     // "Müller" before "Nordlicht"

See

Training: Sorting

sortIconVisible?: BooleanFunction

Show the sort icon in the header. Default: follows sortable resp. sortState.

sortState?: SortState

The sort icon shown in the header: "asc", "desc" or "" (none). It only sets the icon – sort the rows once with TableModelIf.doSort to match it.

sortStatesOrder?: SortState[]

Order of the sort states on repeated double-clicks. Default: TableOptions.sortOrder (["asc", "desc"]).

sortable?: BooleanFunction

The column can be sorted by a double-click on its header (e.g. TrueFn).

type: "RowGroupColumnDef" = "RowGroupColumnDef"

Marker for isRowGroupColumnDef (works across copies of the core).

validate?: CellValidator

Checks edited values, see ColumnDefIf.validate (since 1.1.96).

valueGetter?: ValueGetter

A calculated column, see ColumnDefIf.valueGetter.

valueSetter?: ValueSetter

Writes an edited calculated value back, see ColumnDefIf.valueSetter.

visible: boolean = true
width: SizeIf = ...

Width of the column: px120, new Size(10, "%") or new Size(1, "weight"). See SizeUnitType.

PROPERTY: "RowGroupColumn" = "RowGroupColumn"

The property of the group column.

Methods

  • Creates a column definition from named parameters. Everything is optional; defaults: width 100 px, visible, not editable, sortable only if sortable is given.

    headerRenderer / bodyRenderer / footerRenderer and headerClasses / bodyClasses / footerClasses fill ColumnDefIf.rendererMap and ColumnDefIf.classes.

    Parameters

    • param: {
          bodyClasses?: string[];
          bodyRenderer?: CellRendererIf;
          editInputPipe?: editInputPipe;
          editable?: BooleanFunction;
          footerClasses?: string[];
          footerRenderer?: CellRendererIf;
          formula?: string;
          formulaOptions?: FormulaOptionsIf;
          getEditRenderer?: GetEditRenderer;
          headerClasses?: string[];
          headerLabel?: string;
          headerRenderer?: CellRendererIf;
          isVisible?: BooleanFunction;
          maxWidth?: SizeIf;
          minWidth?: SizeIf;
          property?: string;
          rowDrag?: RowDragColumnOption;
          showValuesAs?: ShowValuesAsConfig;
          sortComparator?: ValueRowSortComparator;
          sortIconVisible?: BooleanFunction;
          sortState?: SortState;
          sortStatesOrder?: SortState[];
          sortable?: BooleanFunction;
          validate?: CellValidator;
          valueGetter?: ValueGetter;
          valueSetter?: ValueSetter;
          width?: SizeIf;
      }
      • Optional bodyClasses?: string[]

        CSS classes of the body cells.

      • Optional bodyRenderer?: CellRendererIf

        Renderer of the body cells.

      • Optional editInputPipe?: editInputPipe

        Converts the editor text before it is stored, e.g. editInputPipeForNumber.

      • Optional editable?: BooleanFunction

        Cells can be edited, e.g. TrueFn.

      • Optional footerClasses?: string[]

        CSS classes of the footer cells.

      • Optional footerRenderer?: CellRendererIf

        Renderer of the footer cells.

      • Optional formula?: string

        A formula column, e.g. "[price] * [quantity] * 1.19" – compiled once into the valueGetter (since 1.1.95, see compileFormula). Takes precedence over valueGetter.

      • Optional formulaOptions?: FormulaOptionsIf

        Own functions of the formula (since 1.1.95).

      • Optional getEditRenderer?: GetEditRenderer

        The editor of this column.

      • Optional headerClasses?: string[]

        CSS classes of the header cell, e.g. ["ge-table-text-align-right"].

      • Optional headerLabel?: string

        Header label.

      • Optional headerRenderer?: CellRendererIf

        Renderer of the header cell.

      • Optional isVisible?: BooleanFunction

        Column is shown (default TrueFn).

      • Optional maxWidth?: SizeIf

        Upper limit for % widths.

      • Optional minWidth?: SizeIf

        Lower limit for % widths.

      • Optional property?: string

        Property of the row object, see ColumnDefIf.property.

      • Optional rowDrag?: RowDragColumnOption
      • Optional showValuesAs?: ShowValuesAsConfig

        „Show values as“: "percentOfColumnTotal", "rank" … (since 1.1.95).

      • Optional sortComparator?: ValueRowSortComparator

        Own comparison of two cell values.

      • Optional sortIconVisible?: BooleanFunction

        Show the sort icon (default: follows sortable).

      • Optional sortState?: SortState

        Initial sort icon ("asc", "desc"); sort the rows with tableModel.doSort() to match.

      • Optional sortStatesOrder?: SortState[]

        Order of the sort states on repeated double-clicks.

      • Optional sortable?: BooleanFunction

        Sortable by double-click on the header, e.g. TrueFn.

      • Optional validate?: CellValidator

        Checks edited values: a message for an invalid value (since 1.1.96).

      • Optional valueGetter?: ValueGetter

        A calculated column: (row, context) => value (since 1.1.95).

      • Optional valueSetter?: ValueSetter

        Makes a calculated column editable (since 1.1.95).

      • Optional width?: SizeIf

        Width, default 100 px.

    Returns ColumnDefIf

    Example

    ColumnDef.create({
    property: "price", headerLabel: "Price", width: px100,
    headerClasses: ["ge-table-text-align-right"], bodyClasses: ["ge-table-text-align-right"],
    sortable: TrueFn
    });