Using the "Column Group Description" Property in Grid Columns

Overview

The Column Group Description property in K2BTools allows developers to group multiple columns under a shared header in grid views. When two or more adjacent columns have the same Column Group Description, a single header will appear above them, making the grid more organized and improving readability for end users. This group header dynamically adjusts to reflect the current state of the grid, including any columns that are moved, shown, or hidden.

GridColumnsExample
Runtime behaviour

The example above shows how the UI is shown when the "Personal Information", "Address", and "Contact information" column groups are defined.

Benefits of Using Column Group Descriptions

  • Enhanced Readability: Grouping related columns under a single header improves the logical flow of information in the grid.
  • Dynamic Adjustments: The grid header updates automatically when columns are moved or toggled, keeping the group headers relevant and up-to-date.

How to Use the Column Group Description Property

The property is located in the Attribute or Variable nodes when they are placed inside a standard grid.

To set the column group description to a set of columns, remember that you can select many nodes in the instance and edit them simultaneously.

ColumnGroupEdit
Editing the column group description property for several nodes at once

Example

Suppose you have three columns: First Name, Last Name, and Age, and you want to group the first two columns under the header "Personal Information". Here’s how you would configure it:

  • Set the Column Group Description for First Name and Last Name to "Personal Information".
  • Leave the Age column without a group description.

The grid will display as follows:

Personal Information
First Name Last Name Age
Row 1 Name Row 1 Last Name Row 1 Age
Row 2 Name Row 2 Last Name Row 2 Age

Dynamic Refresh of Headers

K2BTools automatically adjusts the group headers to reflect the current state of the grid. If you rearrange the columns (using Runtime column reordering) or toggle them on and off (using Runtime column selection in grids), the headers will refresh accordingly. This ensures that:

  • Moved Columns: The group header will follow columns when they are moved, merging the group headers when adyacent columns belong to the same group.
  • Hidden/Shown Columns: If a column in a group is hidden, the header will update to exclude it. When shown, it will reappear in the group header if placed adjacent to other grouped columns.

Tips

  • Keep Group Names Concise: Short, descriptive group names are best for readability.
  • Plan Grouping: Only group columns that logically belong together, as this will improve user navigation within the grid.