robogrid
v0.2.2
Published
RoboGrid: a zero-dependency data grid with row grouping, pivoting, a server-side row model, tree data, master/detail, cell ranges, Excel export and integrated charts.
Maintainers
Readme
RoboGrid
A data grid for the browser, MIT licensed, with the features usually reserved for paid tiers: row grouping, aggregation, pivoting, a server-side row model, tree data, master / detail, cell range selection with a fill handle, clipboard, set filters, a side bar with tool panels, a status bar, context and column menus, Excel export and integrated charts.
- Original code, zero dependencies. Written from scratch. No third-party grid or chart code is included or required.
- One package, two entries.
robogrid(plain JavaScript) androbogrid/react. - ESM, CommonJS and a script-tag build, with TypeScript declarations.
- Documented. Guides plus a reference generated from the source and checked against it on every build.
Install
npm install robogridreact and react-dom (18 or later) are optional peers, needed only for robogrid/react.
Use
import { createGrid, themeRobo } from 'robogrid';
const api = createGrid(document.querySelector('#grid'), {
theme: themeRobo,
columnDefs: [
{ field: 'country', rowGroup: true, hide: true },
{ field: 'athlete', filter: true },
{ field: 'gold', aggFunc: 'sum' },
],
rowData,
sideBar: true,
cellSelection: true,
});The element needs a height. createGrid returns the grid api.
import { RoboGridReact, themeRobo } from 'robogrid/react';
<div style={{ height: 500 }}>
<RoboGridReact ref={gridRef} theme={themeRobo} columnDefs={columnDefs} rowData={rowData} />
</div>;Every option is a prop, every event has an on<Event> prop, and gridRef.current.api is the api. React components can be used wherever the grid takes a component.
Documentation
Start at docs/README.md. The guides and the reference ship inside the package, so after installing they are also on disk at node_modules/robogrid/docs/.
| Guides | Reference | | --- | --- | | Getting started | Grid options | | Columns | Column properties | | Rows and data | Grid api | | Server-side row model | Events | | Grouping, aggregation and pivot | Names | | Tree data and master / detail | | | Filtering | | | Selection | | | Editing and clipboard | | | Components | | | React | | | Side bar, status bar, menus and pagination | | | Export and charts | | | Theming | | | Saving and restoring state | | | Limitations | |
What is in the box
| Area | Features |
| --- | --- |
| Row models | Client-side; server-side (lazy blocks per group level, server pivot, partial refresh, transactions); infinite scrolling |
| Columns | Groups with expand / collapse, pinning, resize, drag to re-order, flex, auto-size, size-to-fit, column types, virtualisation |
| Grouping | One or several group columns or full-width group rows, default expansion, group and grand total rows, child counts, group selection |
| Aggregation | sum min max count avg first last, custom functions |
| Pivot | Pivot mode, multi-level pivot columns, row totals, pivot panel |
| Tree data | By path, by parent id or by nested children; filler nodes; roll-up aggregation |
| Master / detail | Nested grids in detail rows, custom detail renderers |
| Filtering | Text, number, date, set and multi filters, floating filters, quick filter, external filter, advanced filter expressions, filters panel |
| Selection | Row selection with checkboxes and select-all; cell ranges, fill handle with series, range handle |
| Editing | Text, number, date, select, rich select, large text and checkbox editors, popup editors, full-row editing, read-only edit requests, undo / redo |
| Clipboard | Copy, cut and paste of ranges, rows or cells, spreadsheet-compatible |
| Rendering | Row and column virtualisation, a million rows and more, pinned rows, full-width rows, column and row span, cell flashing, animated rows and columns, tooltips |
| Chrome | Side bar (columns, filters and custom panels), row group and pivot bars, status bar, pagination, overlays |
| Menus | Context menu, column menu, column chooser, custom items and sub menus |
| Export | CSV and real .xlsx (styles, merged headers, outlines, frozen panes, several sheets) |
| Charts | Range and pivot charts linked to the grid, 24 chart types, image download, sparklines in cells |
| Other | Right-to-left, theming by CSS variables, dark mode, translation, row dragging, keyboard navigation, saved state |
Package contents
dist/ robogrid.esm.js, robogrid.cjs, robogrid.min.js (global RoboGrid),
robogrid-react.esm.js, robogrid-react.cjs
src/ the source, plain ES modules (src/react: the wrapper, src/charts: the chart engine)
types/ index.d.ts, react.d.ts
docs/ guides and referenceThe React bundles load the core from robogrid, so an app that imports both entries gets one copy of the grid.
Working on RoboGrid
From a checkout of the source (the build scripts and demo pages are not part of the published package):
npm install
npm run build # bundles into dist/
npm run docs # regenerate docs/reference and types/ from the source
npm run check # reference matches the code; nothing third-party has crept in
npm run demo # http://localhost:4320/demo/The demo pages cover grouping and charts, the server-side row model, pivoting, editing and clipboard, tree data, master / detail, a million-row grid, and React.
npm run check runs before every npm pack / npm publish. It fails when an option, column property, event or api method exists in the code but not in the reference (or the reverse), and when the package depends on, imports or names another grid product.
Moving from another grid
Option, column and api names follow the conventions common to data grids, so most configuration carries over unchanged. Two options bridge the rest, without RoboGrid knowing anything about the other grid: you supply the old names.
components: {
oldSetFilterName: 'rgSetColumnFilter', // a string is an alias for a registered component
},
columnIdAliases: {
'old-group-column-id': 'rg-auto-group', // ids used by saved column state
},See Components and Saving and restoring state. CSS written against another grid's class names needs moving to rg-*, and localeText keys are RoboGrid's own.
Status
RoboGrid is new. It has been exercised through scripted browser runs of the demo pages in Chromium; there is no automated test suite yet. See Limitations for what is not built.
License
MIT. See LICENSE.
