PinnedRowsPlugin
Since v0.1.1
Pinned Rows (Status Bar) Plugin for tbw-grid
Creates fixed status bars 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.
Installation
Section titled “Installation”import { PinnedRowsPlugin } from '@toolbox-web/grid/plugins/pinned-rows';Built-in Aggregation Functions
Section titled “Built-in Aggregation Functions”| Function | Description |
|---|---|
sum | Sum of values |
avg | Average of values |
count | Count of rows |
min | Minimum value |
max | Maximum value |
CSS Custom Properties
Section titled “CSS Custom Properties”| Property | Default | Description |
|---|---|---|
--tbw-pinned-rows-bg | var(--tbw-color-panel-bg) | Status bar background |
--tbw-pinned-rows-border | var(--tbw-color-border) | Status bar border |
| Option | Type | Description |
|---|---|---|
slots? | PinnedRowSlot[] | Unified ordered list of pinned-row slots. Slots are rendered in declared order within their position (‘top’ or ‘bottom’, default ‘bottom’). |
fullWidth? | boolean | Default fullWidth mode for all aggregation rows. When true, each aggregation row renders as a single spanning cell with label and aggregated values inline. When false (default), rows render per-column cells aligned to the grid template. Individual AggregationRowConfig.fullWidth (or AggregationSlot.fullWidth) overrides this. |
Example
Section titled “Example”Status Bar with Aggregation
Section titled “Status Bar with Aggregation”import '@toolbox-web/grid';import { PinnedRowsPlugin, rowCountPanel,} from '@toolbox-web/grid/plugins/pinned-rows';
grid.gridConfig = { columns: [ { field: 'product', header: 'Product' }, { field: 'quantity', header: 'Qty', type: 'number' }, { field: 'price', header: 'Price', type: 'currency' }, ], plugins: [ new PinnedRowsPlugin({ slots: [ { id: 'totals', position: 'bottom', aggregators: { quantity: 'sum', price: 'sum' }, cells: { product: 'Totals:' }, }, { id: 'count', position: 'bottom', render: rowCountPanel() }, ], }), ],};See Also
Section titled “See Also”PinnedRowsConfigfor all configuration optionsAggregationRowConfigfor aggregation row structure
Extends BaseGridPlugin
Inherited methods like
attach(),detach(),afterRender(), etc. are documented in the base class.
Methods
Section titled “Methods”refresh()
Section titled “refresh()”Refresh the status bar to reflect current grid state.
refresh(): voidgetContext()
Section titled “getContext()”Get the current status bar context.
getContext(): PinnedRowsContextReturns
Section titled “Returns”PinnedRowsContext - The context with row counts and other info
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://toolboxjs.com/llms-full.txt