▦K2 Advanced GridsDeveloper Portal / 0.24
Documentation / Grid layout

Column resizing & AutoFit

Resize columns by dragging their boundaries, or automatically fit widths to loaded cell content.

Prerequisites and quick start

Enable horizontal scrolling first. Resizing and AutoFit depend on its explicit width model. Enable the following module under defaults or test it temporarily in Console.

Object.assign(K2AdvancedGridsConfig.defaults.columnResize, {
    "enabled": true,
    "minWidth": 60,
    "maxWidth": 800,
    "handleWidth": 6,
    "fullHeightHandle": true,
    "highlightOnHover": true,
    "indicatorColor": "auto",
    "indicatorWidth": 2,
    "autoFitOnDoubleClick": true
});
K2AdvancedGrids.instance.refresh();
Download resizing and AutoFit configuration ↓
Required after saving a configuration file

Replace REPLACE_WITH_YOUR_AREAITEMID with your own ID (see Grid Discovery). Save the file and update configVersion in the Data Label loader, for example to 0.5.0 or another unused version. Save the form and reopen Runtime. Keep engineVersion unchanged unless the engine changes. Console-only experiments do not need a version change. If the downloaded filename differs, update the loader path or rename the file to purchase-orders.config.js.

Manual resizing

Hover near the boundary of Vendor Name. Drag the boundary to widen the column. Full-height handles allow this interaction along the visible grid body, not only at the header.

Full-height resize indicator
Figure 37 · Full-height resize indicator · Actual K2 Runtime capture
Vendor Name widened manually
Figure 38 · Vendor Name widened manually · Actual K2 Runtime capture

AutoFit

Scroll to Description, narrow it and double-click the column boundary. AutoFit measures the header and loaded row text, with padding and width limits. It does not query additional records.

Description before AutoFit
Figure 39 · Description before AutoFit · Actual K2 Runtime capture
Description after AutoFit
Figure 40 · Description after AutoFit · Actual K2 Runtime capture

Configuration reference

ParameterType / examplePurpose
enabledboolean / trueEnable resizing.
minWidthpositive integer / 60Minimum resize width in pixels, constrained by horizontal settings.
maxWidthpositive integer / 800Maximum resize width in pixels, constrained by horizontal settings.
handleWidthpositive integer / 6Boundary hit area in pixels; engine clamps hit radius.
fullHeightHandleboolean / trueAllow interaction along the visible column body.
highlightOnHoverboolean / trueShow the indicator on hover.
indicatorColorCSS color / autoAuto uses theme accent or fallback blue.
indicatorWidthpositive integer / 2Indicator thickness, clamped to 1–8 px.
autoFitOnDoubleClickboolean / trueEnable double-click AutoFit.

Interactive example

Offline simulation: adjust the Vendor Name width or select AutoFit. Actual measurements depend on K2 theme and loaded text.

OrderVendor NameDepartment
PO-00001Apex ServicesProcurement
PO-00002Blue Horizon SuppliesOperations
PO-00003Atlas Office SolutionsFacilities

Advantages and limitations

Users can adapt widths without editing the K2 View. Very long text may still truncate at the configured maximum. Widths are not persisted across reloads unless Personal Preferences are enabled and configured. For the next lesson retain horizontal scrolling and resizing, disable vertical scrolling, and keep classic pagination with ten rows.

Enlarged screenshot