▦K2 Advanced GridsDeveloper Portal / 0.24
Documentation / Column management

Column reordering

Move columns to prioritize the information needed for a task.

Prerequisites and quick start

Continue from the previous lesson. Use the non-editable 17-column ListView and keep native pagination disabled. The full downloadable configuration includes all preceding features. For a temporary Console experiment use:

Object.assign(K2AdvancedGridsConfig.defaults.columnReordering, {
    "enabled": true,
    "allowUserReordering": true,
    "initialOrder": []
});
K2AdvancedGrids.instance.refresh();
Download reordering configuration ↓
Required after saving a configuration file

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

Drag and drop

Unpin Vendor Name if necessary. Drag Order Amount and Budget Variance toward the beginning of the unpinned region. The header itself is the drag target; the drop indicator shows the intended position.

Header drag interaction
Figure 49 · Header drag interaction · Actual K2 Runtime capture
Drop position indicator
Figure 50 · Drop position indicator · Actual K2 Runtime capture
Financial columns moved toward the start
Figure 51 · Financial columns moved toward the start · Actual K2 Runtime capture

Header menu and sorting

Move toward start/end moves a column within its pin group. Reset column order restores the configured order. Sort ascending and descending are also available in this menu; the captures show Order Amount sorted descending.

Move and reset order commands
Figure 52 · Move and reset order commands · Actual K2 Runtime capture

Set an initial order

K2AdvancedGridsConfig.defaults.columnReordering.initialOrder = [
    "Order Number", "Vendor Name", "Order Amount", "Budget Variance"
];
K2AdvancedGrids.instance.refresh();

Unlisted columns follow in their original order, subject to pinning.

Interactive example

Offline simulation: select a column and move it using the buttons.

Configuration reference

ParameterValue in lessonBehavior
enabledtrueEnable reordering
allowUserReorderingtrueAllow runtime movement
initialOrder[]Initial priority order; omitted columns are appended

Console commands

Replace the placeholder with your own Area Item ID (see Grid Discovery).

const id = 'REPLACE_WITH_YOUR_AREAITEMID';
K2AdvancedGrids.instance.moveColumn(id, 'Order Amount', 'Department', false);
K2AdvancedGrids.instance.resetColumnOrder(id);

Benefits and limitations

Requires horizontal scrolling. Movement across pin groups is not allowed. Hidden columns cannot be dragged. Sorting rows and reordering columns are separate operations.

Enlarged screenshot