PinnedRowsPlugin
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';Configuration Options
Section titled “Configuration Options”| Option | Type | Default | Description |
|---|---|---|---|
position | 'top' | 'bottom' | 'bottom' | Status bar position |
showRowCount | boolean | true | Show total row count |
showSelectedCount | boolean | true | Show selected row count |
showFilteredCount | boolean | true | Show filtered row count |
fullWidth | boolean | false | Default fullWidth for aggregation rows |
aggregationRows | AggregationRowConfig[] | - | Aggregation row configs |
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 |
Example
Section titled “Example”Status Bar with Aggregation
Section titled “Status Bar with Aggregation”import '@toolbox-web/grid';import { PinnedRowsPlugin } 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({ position: 'bottom', showRowCount: true, aggregationRows: [ { id: 'totals', aggregators: { quantity: 'sum', price: 'sum' }, cells: { product: 'Totals:' }, }, ], }), ],};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
addPanel()
Section titled “addPanel()”Add a custom panel to the info bar.
addPanel(panel: PinnedRowsPanel): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
panel | PinnedRowsPanel | The panel configuration to add |
removePanel()
Section titled “removePanel()”Remove a custom panel by ID.
removePanel(id: string): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id | string | The panel ID to remove |
addAggregationRow()
Section titled “addAggregationRow()”Add an aggregation row.
addAggregationRow(row: AggregationRowConfig): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
row | AggregationRowConfig | The aggregation row configuration |
removeAggregationRow()
Section titled “removeAggregationRow()”Remove an aggregation row by ID.
removeAggregationRow(id: string): voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id | string | The aggregation row ID to remove |
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