Skip to content

Pinned Rows (Status Bar) Plugin

The Pinned Rows plugin creates a fixed status bar at the top or bottom of the grid for displaying aggregations, row counts, or custom content. Think of it as the “totals row” you’d see in a spreadsheet—always visible regardless of scroll position.

import '@toolbox-web/grid/features/pinned-rows';

Configure aggregation rows with built-in functions (sum, avg, count, min, max) or custom aggregators. Each aggregation row can have different calculations per column.

import { queryGrid } from '@toolbox-web/grid';
const grid = queryGrid('tbw-grid');
grid.gridConfig = {
columns: [
{ field: 'product', header: 'Product' },
{ field: 'quantity', header: 'Qty', type: 'number' },
{ field: 'price', header: 'Price', type: 'currency' },
],
features: {
pinnedRows: {
position: 'bottom',
showRowCount: true,
aggregationRows: [
{
id: 'totals',
aggregators: {
quantity: 'sum',
price: { aggFunc: 'sum', formatter: (v) => `$${v.toFixed(2)}` },
},
cells: { product: 'Totals:' },
},
],
},
},
};

Use the controls to change position, toggle row count, switch between single and multiple aggregation rows, or enable full-width mode.

Position Position of the status bar
Show row count Show total row count in info bar
Multiple aggregation rows Show sum, average, and min/max rows
Full width Render aggregation rows as single spanning cell
OptionTypeDefaultDescription
position'top' | 'bottom''bottom'Status bar position
showRowCountbooleantrueDisplay row count
showSelectedCountbooleantrueDisplay selected row count
showFilteredCountbooleantrueDisplay filtered row count
fullWidthbooleanfalseDefault fullWidth mode for all aggregation rows
aggregationRowsAggregationRowConfig[][]Aggregation footer rows
customPanelsPinnedRowsPanel[][]Custom info bar panels

Configure computed footer/header rows with aggregators:

features: {
pinnedRows: {
aggregationRows: [
{
id: 'totals',
position: 'bottom',
aggregators: {
// Simple string aggregator
quantity: 'sum',
// Object syntax with formatter
price: {
aggFunc: 'sum',
formatter: (value) => `$${value.toFixed(2)}`,
},
},
cells: { id: 'Totals:', name: '' },
},
],
},
},
SyntaxExampleDescription
String'sum'Built-in aggregator
Function(rows, field) => rows.lengthCustom aggregator function
Object{ aggFunc: 'sum', formatter: (v) => v.toFixed(2) }Aggregator with formatter

sum, avg, count, min, max, first, last

When fullWidth is true, aggregation rows render as a single spanning cell with the label and aggregated values displayed inline—similar to the row grouping plugin’s full-width mode. When false (the default), each column gets its own cell aligned to the grid template.

Set fullWidth globally on the plugin config or per-row on AggregationRowConfig. Per-row settings override the global default:

features: {
pinnedRows: {
fullWidth: true, // All aggregation rows span full width by default
aggregationRows: [
{
id: 'totals',
label: 'Totals',
aggregators: { quantity: 'sum', price: 'sum' },
},
{
id: 'detail',
fullWidth: false, // Override: render per-column
aggregators: { quantity: 'avg', price: 'avg' },
cells: { product: 'Averages:' },
},
],
},
},
features: {
pinnedRows: {
customPanels: [
{
id: 'info',
position: 'right',
render: (ctx) => `<span>Rows: ${ctx.totalRows}</span>`,
},
],
},
},
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt