▦K2 Advanced GridsDeveloper Portal / 0.24
Documentation / Data management

Pagination & Load More

Keep a large loaded register manageable with numbered pages or progressive row display, while filtering the entire loaded dataset.

Overview and prerequisites

Continue from First configuration with filtering enabled, nine columns and native K2 pagination disabled. The demo contains 250 loaded orders. No engine changes are required.

Quick start — Classic pagination

Replace the pagination section under defaults with the following settings. Keep the remaining configuration unchanged.

"pagination": {
            "enabled": true,
            "mode": "classic",
            "pageSize": 10,
            "pageSizeOptions": [10, 25, 50, 100],
            "allowPageSizeChange": true,
            "showRecordCount": true,
            "showPageCount": true,
            "showFirstLastButtons": true,
            "resetOnFilter": true,
            "preserveOnRefresh": true
        }
Required configuration change

When downloading a complete configuration, replace REPLACE_WITH_YOUR_AREAITEMID with your actual ListView ID (see Grid Discovery). Save it on the server as purchase-orders.config.js or adjust the loader filename. Increment configVersion, for example to 0.3.0, and reopen the form. Leave engineVersion unchanged.

Download Classic configuration ↓
Classic pagination — 10 records, 25 pages
Figure 13 · Classic pagination — 10 records, 25 pages · Actual K2 Runtime capture

Page navigation and page size

Use the numbered buttons, previous/next or first/last controls. The page-size selector offers 10, 25, 50 or 100 rows.

Page 3 — records 21–30
Figure 14 · Page 3 — records 21–30 · Actual K2 Runtime capture
Available page sizes
Figure 15 · Available page sizes · Actual K2 Runtime capture

Filtering and empty results

Apply Budget Variance greater than 0 and Status Pending Approval. The demo has 14 matching records across two pages, with 250 loaded. With resetOnFilter enabled, changing filters resets navigation to the first page. The screenshot confirms the resulting first page, not the preceding navigation action.

Combined filters — 14 matching records
Figure 16 · Combined filters — 14 matching records · Actual K2 Runtime capture

Increase the Budget Variance threshold to 10000 while retaining Pending Approval. No rows match; navigation is disabled and the counter shows Page 0 of 0.

Empty filtered result
Figure 17 · Empty filtered result · Actual K2 Runtime capture

Load More

Set mode to loadMore to display the first batch and append another batch on each click. Download the complete alternative configuration, replace the Area Item ID and update configVersion when deploying it.

Download Load More configuration ↓
Load More — initial 10 rows
Figure 18 · Load More — initial 10 rows · Actual K2 Runtime capture
Load More — 30 rows displayed
Figure 19 · Load More — 30 rows displayed · Actual K2 Runtime capture
All 250 matching records displayed
Figure 20 · All 250 matching records displayed · Actual K2 Runtime capture

Configuration reference

The following settings belong to defaults.pagination or an individual grids entry. Values shown are the lesson configuration, not necessarily engine defaults.

ParameterType / lesson valueBehavior
enabledBoolean / trueEnable client-side pagination.
modeclassic | loadMore / classicNumbered pages or progressive display.
pageSizePositive integer / 10Initial rows per page or batch.
pageSizeOptionsInteger array / [10,25,50,100]Options in the page-size selector.
allowPageSizeChangeBoolean / trueShow the selector.
showRecordCountBoolean / trueShow loaded and matching record counts.
showPageCountBoolean / trueShow page count in Classic mode.
showFirstLastButtonsBoolean / trueShow first/last buttons in Classic mode.
resetOnFilterBoolean / trueReset page or batch limit when filters change.
preserveOnRefreshBoolean / trueRetain page state when the grid element is replaced during refresh, subject to available records.

Console commands

These examples target one grid. Replace the placeholder with your actual ID. See Grid Discovery. Console changes are temporary.

const grid = K2AdvancedGridsConfig.grids.find(g => g.areaItemId === "REPLACE_WITH_YOUR_AREAITEMID");
if (grid) {
    grid.pagination = {...grid.pagination, enabled: true, mode: "loadMore"};
    K2AdvancedGrids.instance.refresh();
}
const target = K2AdvancedGridsConfig.grids.find(g => g.areaItemId === "REPLACE_WITH_YOUR_AREAITEMID");
if (target) {
    target.pagination = {...target.pagination, mode: "classic"};
    K2AdvancedGrids.instance.refresh();
}

Standard vs Advanced

Unlike a native server-paged configuration, these modes operate on the same loaded rows as Advanced Filtering. Classic provides direct navigation; Load More preserves previously displayed rows as batches expand. Neither mode fetches more records from SQL.

Limitations and troubleshooting

  • Client-side pagination does not reduce initial K2 loading or the number of records held in the browser.
  • Disable native pagination for this lesson so filtering can access all loaded rows.
  • Saved personal preferences, when enabled, may override configured page size. Use Reset Grid Preferences if appropriate; this also clears other preferences.
  • If changes are not reflected, check the loaded configuration and increment configVersion in the loader.
Required after saving a configuration file

Update configVersion in the Data Label loader (for example from 0.3.0 to 0.4.0), save the form and reopen Runtime. Keep engineVersion unchanged unless the engine file was modified. Console-only experiments do not need a version change. See Installation & Deployment.

Enlarged screenshot