Skip to content

GroupingList Controller

The GroupingList controller renders a data grid with all records grouped by a specified field, featuring collapsible group headers with expand/collapse toggles. Unlike the standard List controller, GroupingList loads all records at once (no paging) and organizes them into visual groups.

It inherits from the List controller, reusing its filter panel, toolbar, column headers, and standard actions (Add, Edit, View, Delete). The only difference is in how records are displayed: instead of a flat paginated table, records appear under collapsible group headings.

Basic usage

Set Controller: GroupingList on the view and configure the Grouping node under MainTable/Controller:

yaml
Type: Data

Controller: GroupingList

MainTable:
  Model: ACTIVITY
  Controller:
    Grouping:
      FieldName: TYPE
      StartCollapsed: True
      ShowCount: True
        ItemName: activity
        PluralItemName: activities

This produces a grid where activities are grouped by the TYPE field (resolved through its reference to display the type name), with each group initially collapsed. The group header shows the type name and the count of records, for example: Analysis (5 activities).

Grouping configuration

All grouping properties go under MainTable/Controller/Grouping:

PropertyTypeDefaultDescription
FieldNameString(required)Name of the field to group by. Can be any field including reference fields (which display the referenced value) or expression-based fields.
StartCollapsedBooleanFalseIf True, all groups appear initially collapsed (only the group header is visible). Users can click to expand.
ShowCountBooleanFalseIf True, shows the record count in each group header.
ShowCount/ItemNameString(empty)Singular noun used when count is 1 (e.g. activity).
ShowCount/PluralItemNameString(empty)Plural noun used when count > 1 (e.g. activities).
ShowNameBooleanFalseIf True, prefixes the group value with the field's display label (e.g. Type: Analysis instead of just Analysis).
SortFieldNamesString(grouping field)Space-separated list of field names for the ORDER BY clause. Defaults to the grouping field. Use this to add a secondary sort within each group.

Group header format

The group header text is built as follows:

  • ShowName: False (default): Analysis
  • ShowName: True: Type: Analysis
  • ShowCount: True with count=1 and ItemName: Analysis (1 activity)
  • ShowCount: True with count>1 and PluralItemName: Analysis (5 activities)
  • ShowCount: True without ItemName/PluralItemName: Analysis (5)

Sorting

By default, records are sorted by the grouping field only. Use SortFieldNames to define a multi-field sort:

yaml
Grouping:
  FieldName: TYPE
  SortFieldNames: TYPE ACTIVITY_DATE

This sorts first by TYPE (to keep groups together), then by ACTIVITY_DATE within each group. Each field name in the list must correspond to a field defined in the view table.

Expand/Collapse behavior

  • Clicking a group header toggles the visibility of the data rows in that group.
  • The toggle icon changes between (collapsed) and (expanded).
  • The toggle is pure client-side JavaScript (no server round-trip).

Filters

GroupingList supports the same filter system as the List controller. If a Filters node is defined under Controller, the filter panel is rendered above the grid and all records are reloaded (with the filter applied) when the user changes filter criteria.

Toolbar and actions

The toolbar is identical to the List controller: Add, Edit, View, Delete, Refresh, and custom ToolViews are all supported. Double-clicking a data row opens the form in Edit or View mode (depending on permissions).

Complete example

From the TasKitto sample application (ActivitiesByType.yaml):

yaml
Type: Data

Controller: GroupingList

MainTable:
  PluralDisplayLabel: Activities by Type
  Model: ACTIVITY
  EditController:
    CloneButton:
    Width: 1220
    Height: 460

  Controller:
    Form:
      Layout: ActivityInput_Form

    Grouping:
      FieldName: TYPE
      EnableMenu: False
      StartCollapsed: True
      ShowName: False
      ShowCount: True
        ItemName: activity
        PluralItemName: activities
      SortFieldNames: TYPE ACTIVITY_DATE

Differences from List controller

FeatureListGroupingList
PagingYes (configurable page size)No (all records loaded)
Record displayFlat rowsGrouped with collapsible headers
SortingUser-clickable column sort with arrow indicatorsFixed sort by SortFieldNames
FiltersSupportedSupported
ToolbarSupportedSupported
Double-clickOpens formOpens form

Released under Apache License, Version 2.0.