Intelligent GridDocumentation

Getting started

Install

npm install @andmarruda/intelligent-grid sorla-db

sorla-db (1.7.1 or newer) is a peer dependency: the grid stores its rows in SorlaDB, and you provide the library.

Load SorlaDB

The SorlaDB 1.0 package ships a browser bundle that registers window.sorla. The grid uses it automatically:

<script src="node_modules/sorla-db/dist/sorla.min.js"></script>

You can also pass the class (or an instance) explicitly, which is what you do in Node or tests:

new IntelligentGrid('#grid', { sorla: window.sorla, columns, data });

Each grid creates its own SorlaDB database (intelligent_grid_1, intelligent_grid_2…). Use the database option to choose the name.

Pick a build

File Use it for
dist/index.js ES module: bundlers (Vite, webpack, esbuild) or <script type="module">
dist/index.cjs CommonJS require()
dist/intelligent-grid.min.js Classic <script> tag: registers window.IntelligentGrid
dist/intelligent-grid.css / .min.css Styles (required)
dist/types/ TypeScript declarations (picked up automatically)
// bundler / ES module
import { IntelligentGrid } from '@andmarruda/intelligent-grid';
import '@andmarruda/intelligent-grid/styles.css';
<!-- no bundler -->
<link rel="stylesheet" href="node_modules/@andmarruda/intelligent-grid/dist/intelligent-grid.min.css">
<script src="node_modules/sorla-db/dist/sorla.min.js"></script>
<script src="node_modules/@andmarruda/intelligent-grid/dist/intelligent-grid.min.js"></script>
<script>
  const grid = new IntelligentGrid('#grid', { columns: [...], data: [...] });
  // every other export hangs off the global: IntelligentGrid.toCSV, IntelligentGrid.ERRORS...
</script>

First grid

<div id="orders"></div>
import { IntelligentGrid } from '@andmarruda/intelligent-grid';

const grid = new IntelligentGrid('#orders', {
    locale: 'pt-BR',
    idField: 'id',
    editable: true,
    data: [
        { id: 1, product: 'Café', qty: 2, price: 9.5, due: '2026-11-03' },
        { id: 2, product: 'Bolo', qty: 1, price: 32, due: '2026-11-10' }
    ],
    columns: [
        { field: 'product', title: 'Produto', validate: { required: true } },
        { field: 'qty', title: 'Qtd', type: 'integer', footer: 'sum' },
        { field: 'price', title: 'Preço', type: 'currency' },
        { field: 'total', title: 'Total', type: 'currency', formula: '=[@qty]*[@price]', footer: 'sum' },
        { field: 'due', title: 'Vencimento', type: 'date' }
    ]
});

grid.on('cellChange', event => api.save(event.detail.row));

What you get out of the box:

Data rules

Using React, Vue, Svelte or Angular? See React, Vue, Svelte and Angular.

Next: Columns · Grid options · Examples

Edit this page on GitHub