@libregrid/status-bar
v1.3.5
Published
Status Bar for AG Grid Community — part of LibreGrid
Maintainers
Readme
@libregrid/status-bar
Show row counts and selection summaries below the grid. Built-in panels report total, filtered, or selected rows and aggregate numeric cell ranges.
Install
npm install "ag-grid-community@^36.2.0" @libregrid/status-barRequires ag-grid-community >=36.1.0 <37 as a peer dependency.
Usage
In a browser TypeScript project, add a grid container before running the code:
<div id="grid" style="height: 400px"></div>import { ModuleRegistry, AllCommunityModule, createGrid } from 'ag-grid-community';
import { StatusBarModule } from '@libregrid/status-bar';
import { CellSelectionModule } from '@libregrid/cell-selection';
ModuleRegistry.registerModules([AllCommunityModule, StatusBarModule, CellSelectionModule]);
createGrid(document.querySelector<HTMLElement>('#grid')!, {
columnDefs: [{ field: 'name' }, { field: 'amount' }],
rowData: [{ name: 'Widget', amount: 42 }],
cellSelection: true,
statusBar: {
statusPanels: [
{ statusPanel: 'agTotalAndFilteredRowCountComponent', align: 'left' },
{ statusPanel: 'agAggregationComponent', key: 'aggregation' },
],
},
});agAggregationComponent sums, counts, and averages selected numeric cells.
Select a range (with @libregrid/cell-selection registered) to see it
update.
API
StatusBarModule registers the following built-in panels:
| Export | Status panel name | Purpose |
| ------------------------------- | ------------------------------------- | ---------------------------------------------- |
| TotalRowCountPanel | agTotalRowCountComponent | Total row count. |
| TotalAndFilteredRowCountPanel | agTotalAndFilteredRowCountComponent | Total and filtered row counts together. |
| FilteredRowCountPanel | agFilteredRowCountComponent | Filtered row count only. |
| SelectedRowCountPanel | agSelectedRowCountComponent | Selected row count. |
| AggregationPanel | agAggregationComponent | Sum/count/min/max/avg over the selected range. |
Also exported: aggregate(metrics), the pure function AggregationPanel
uses internally. Use it if you're building a custom status panel and want
the same sum/count/min/max/avg calculation.
Learn more
- LibreGrid README — full package list and quick start
@libregrid/material—MaterialStatusBarComponentfor a Material-styled shell
Angular
Use the same column definitions and grid options with ag-grid-angular.
Register the modules shown above through provideLibreGrid from
@libregrid/angular. See the
Angular setup for a complete component and bootstrap example.
License
MIT — see LICENSE and NOTICE. LibreGrid is an independent project and is not affiliated with, endorsed by, or sponsored by AG Grid Ltd.
