Footer & Overlays
NextGrid manages its footer bar and viewport overlays automatically without overlapping native scrollbars.
import { Grid, type ColumnDef } from 'next-grid-js';import { createOrders, type OrderRow } from './data/orders';import { syncGridTheme } from './theme';import type { DemoMountContext } from './types';import { addButton } from './ui';
export function mount({ stage, controls, meta,}: DemoMountContext): () => void { const columnDefs: readonly ColumnDef<OrderRow>[] = [ { key: 'id', name: 'ID', width: 96, isSortable: true, }, { key: 'customer', name: 'Customer', width: 175, flex: 1, isSortable: true, }, { key: 'region', name: 'Region', width: 110, isSortable: true, }, { key: 'amount', name: 'Amount', width: 115, cellDataType: 'number', isSortable: true, formatter: ({ value }) => `$${Number(value).toLocaleString('en-US')}`, }, ];
const grid = new Grid<OrderRow>({ container: stage, columnDefs, rowData: createOrders(85), getRowId: (row) => row.id, rowSelection: { mode: 'multiple', showCheckbox: true, }, initialState: { version: 5, pagination: { enabled: true, page: 0, pageSize: 10, }, }, }); const stopTheme = syncGridTheme(stage);
const updateMeta = () => { const p = grid.getPaginationState(); meta.textContent = `Page ${p.page + 1} · Size ${p.pageSize}`; }; grid.addEventListener('paginationChanged', updateMeta);
addButton(controls, 'Select page', () => grid.selectAllRows('page')); addButton(controls, 'Page size 25', () => { grid.setPaginationState({ enabled: true, page: 0, pageSize: 25, }); }); addButton(controls, 'Page size 10', () => { grid.setPaginationState({ enabled: true, page: 0, pageSize: 10, }); }); updateMeta();
return () => { grid.destroy(); stopTheme(); };}When the Footer Appears
Section titled “When the Footer Appears”The footer bar mounts automatically whenever at least one footer capability is active:
- Pagination (
pagination.enabled: true): First/previous/next/last page buttons, Rows per page selector,Page X of Y(orPage X of about Ywhen a remote source reports an'estimated'count), and active row range (footerRowRange/footerRowRangeAbout). - Data Export (
dataExport): Format selector and Export button (or a single direct button when only one format is configured). - Layout Recovery Controls:
- Unpin all columns appears automatically if an external container resize shrinks the center viewport below
minCenterWidth. - Clear pinned rows appears automatically if an external resize shrinks the body height below
minBodyHeight.
- Unpin all columns appears automatically if an external container resize shrinks the center viewport below
Built-in Overlays
Section titled “Built-in Overlays”.grid-overlay-wrapper renders status overlays inside .grid-body-viewport:
| Overlay State | When Shown | Locale Key |
|---|---|---|
| Loading | Remote model awaiting initial rows (overlayLoading) |
overlayLoading |
| Empty | Zero rows in source (overlayEmpty) |
overlayEmpty |
| No Match | Client filters or quick filter match zero rows (overlayNoMatch) |
overlayNoMatch |
| Error | Terminal datasource error (overlayError) |
overlayError |
| Row Heights Error | Unrecoverable variable row height error (overlayRowHeightsError) |
overlayRowHeightsError |
Customize overlay text via localeText and surface styling via --next-grid-overlay-bg and --next-grid-loading-text.