▦K2 Advanced GridsDeveloper Portal / 0.24
Documentation / Data presentation

Boolean formatting

Replace raw true and false with meaningful read-only visual indicators without changing SmartObject values.

Prepare the example

Continue from Personal preferences. Keep filtering, classic paging and KPI summary. Use Manage columns to show Order Number, Vendor Name, Department, Expected Delivery Date, Order Amount, Budget Variance, Status, Is Approved and Is Urgent. Unpin Status for the comparison. Saved preferences may override initial widths, visibility and pinning.

Icon mode

K2AdvancedGridsConfig.defaults.booleanFormatting = {
    "enabled": true,
    "mode": "icon",
    "alignment": "center",
    "iconSize": 20,
    "trueText": "auto",
    "falseText": "auto",
    "nullText": "—",
    "trueColor": "auto",
    "falseColor": "auto",
    "columns": {}
};
K2AdvancedGrids.instance.refresh();
Download icon configuration ↓
Required after saving a configuration file

Replace REPLACE_WITH_YOUR_AREAITEMID with your own ID (see Grid Discovery). Rename the downloaded file to purchase-orders.config.js or update the loader path. Update configVersion in the Data Label (e.g. 0.7.1), save the form and reopen Runtime. Keep engineVersion unchanged. Console-only changes do not require a version change.

Icon mode
Figure 57 · Icon mode · Actual K2 Runtime capture

Checkbox mode

K2AdvancedGridsConfig.defaults.booleanFormatting.mode = 'checkbox';
K2AdvancedGrids.instance.refresh();
Checkbox mode
Figure 58 · Checkbox mode · Actual K2 Runtime capture

Text mode

K2AdvancedGridsConfig.defaults.booleanFormatting.mode = 'text';
K2AdvancedGrids.instance.refresh();
Text mode
Figure 59 · Text mode · Actual K2 Runtime capture

Badge mode

K2AdvancedGridsConfig.defaults.booleanFormatting.mode = 'badge';
K2AdvancedGrids.instance.refresh();
Badge mode
Figure 60 · Badge mode · Actual K2 Runtime capture

Per-column formatting

Use green approval icons and a red Urgent badge; Normal is neutral.

K2AdvancedGridsConfig.defaults.booleanFormatting = {
    "enabled": true,
    "mode": "icon",
    "alignment": "center",
    "iconSize": 20,
    "trueText": "auto",
    "falseText": "auto",
    "nullText": "—",
    "trueColor": "auto",
    "falseColor": "auto",
    "columns": {
        "Is Approved": {
            "mode": "icon",
            "iconSize": 22,
            "trueColor": "#26845B",
            "falseColor": "#94A3B8"
        },
        "Is Urgent": {
            "mode": "badge",
            "trueText": "Urgent",
            "falseText": "Normal",
            "trueColor": "#DC2626",
            "falseColor": "#64748B"
        }
    }
};
K2AdvancedGrids.instance.refresh();
Download per-column configuration ↓
Per-column icon and badge modes
Figure 61 · Per-column icon and badge modes · Actual K2 Runtime capture

Interactive playground

Offline simulation; change the mode, labels and colors to generate a Boolean configuration fragment.

Configuration reference

ParameterBehavior
enabledEnable the module or override per column.
modeicon, checkbox, text, badge
alignmentstart, center, end
iconSizeClamped to 10–48 pixels.
trueText / falseTextauto uses localized Yes/No; or custom labels.
nullTextDefault em dash.
trueColor / falseColorauto or valid CSS color.
columnsOverrides by column key, name or title.

Benefits and limitations

Read-only display; checkboxes are not editable. Requires standard Yes/No cells with raw metadata and simple text wrappers. Formatting does not replace original data or authorize access.

Enlarged screenshot