Guide

JavaScript Data Grid

A data grid is a table that stays usable at 100,000 rows. This is what that costs you, what ApexGrid ships in each tier, and how to tell when you do not need one.

Simple GridOpen in new tab

Built with ApexGrid

A JavaScript data grid is a component that renders tabular data and keeps it usable at a size where a plain HTML table stops working. It virtualizes rows, so only the ones on screen exist in the DOM, and it ships the interactions you would otherwise write yourself: sorting, filtering, in-cell editing, column pinning and keyboard navigation.

ApexGrid is the one in this family. It is a standards-based custom element, so it works in plain HTML and inside React, Vue or Angular without a wrapper:

npm install apex-grid

<apex-grid id="grid"></apex-grid>

<script type="module">
  import 'apex-grid/define'

  const grid = document.getElementById('grid')
  grid.columns = [
    { key: 'account', headerText: 'Account' },
    { key: 'revenue', headerText: 'Revenue', type: 'currency' },
    { key: 'health', headerText: 'Health', type: 'status' },
  ]
  grid.data = [
    { account: 'Northwind', revenue: 491611, health: 'healthy' },
    { account: 'Contoso', revenue: 485513, health: 'at risk' },
  ]
</script>

Do you actually need a data grid?

A grid is a real dependency. It is worth taking on when the table has work to do, and not before.

What you needReach for
A few hundred read-only rows, no interactionA plain <table>. It costs nothing and is fully accessible by default.
Sorting and a search box over a few hundred rowsA plain table plus your own sort and filter. Roughly 40 lines.
Thousands of rows, or any scroll performance concernA data grid. Virtualization is the thing you should not write yourself.
Editing values in place, with validationA data grid. In-cell editing plus keyboard commit and cancel is far more work than it looks.
Grouping, subtotals or pivotingA data grid with an analytics tier.
Comparing magnitudes rather than reading valuesA chart, not a table. If nobody needs the exact number, a table is the wrong shape.

The last row is the one worth pausing on. A grid of 5,000 numbers that people only scan for outliers is a chart nobody drew yet.

What ApexGrid ships in each tier

Community is the grid. Enterprise is the analytics layer on top of it, as a drop-in <apex-grid-enterprise> element that inherits every Community feature.

CommunityEnterprise
Virtualized rows and columnsYesYes
All 13 column typesYesYes
Sorting, filtering, quick filterYesYes
Inline editing and cell validationYesYes
Column pinning, reordering, groupsYesYes
Row selection, expansion, pinning, reorderingYesYes
Tree data, pagination, state persistenceYesYes
CSV exportYesYes
Row grouping and aggregationsNoYes
PivotingNoYes
Range selectionNoYes
Integrated chartsNoYes
Formula engineNoYes
AI toolkitNoYes
Excel exportNoYes

Community is included on every plan and is free for organizations under $2M in annual revenue. Enterprise requires the Premium or OEM plan. Nothing here is open source: source being published on GitHub is not the same thing as an open licence. The full matrix is on the ApexGrid page and the pricing page.

The 13 column types

A column's type decides how it renders, how it sorts, and which editor it uses in inline-edit mode. As of apex-grid 3.4.0 there are thirteen:

TypeRenders as
stringPlain text. The default.
numberThe value as-is, in tabular figures. No thousands separators
booleanA checkbox, editable in place when the column is editable
selectA dropdown of options, accepting bare values or { value, label } pairs
dateA formatted date. YYYY-MM-DD is read as a floating date, so it shows the same calendar day in every timezone
ratingA star rating
imageAn image from the cell value
avatarA circular avatar
currencyA formatted money value
badgeA pill
statusA coloured dot plus label, with the variant inferred from the value or set by statusVariant
progressA progress bar
sparklineAn inline mini chart

For anything else, a column's cellTemplate takes over rendering entirely. It receives the cell value and returns a Lit template:

{
  key: 'revenue',
  headerText: 'Revenue',
  type: 'number',                                  // numeric filter operands
  cellTemplate: ({ value }) => `$${(value / 1000).toFixed(0)}k`,
}

Keeping type: 'number' alongside the template matters, but not for the reason you might expect. Sorting compares the stored values, so it is numeric either way. What the type decides is the filter operands: only number and boolean get their own sets, so number is what gives the column "greater than" instead of "contains". A type: 'currency' column formats money automatically but can only be filtered as text, which is the tradeoff the column-types reference lays out in full.

Where a different grid is the better choice

Being honest about this is more useful than pretending otherwise.

  • Your component library already has one. If you are already shipping a design system with a table component that virtualizes, using it costs you nothing extra and keeps one set of theming tokens.
  • You need a spreadsheet, not a grid. Multi-sheet workbooks, cell references across sheets and a full formula surface are a different product category. ApexGrid Enterprise has a formula engine, but it is a grid with formulas rather than a spreadsheet application.
  • Server-side everything at very large scale. ApexGrid Enterprise has an infinite row model for paging data in from a server. If your requirement is that grouping, sorting and aggregation all execute in the database over hundreds of millions of rows, evaluate that path specifically rather than assuming any client grid covers it.

Using a grid with charts

The common case is a grid and a chart on the same screen, filtered together. Clicking a chart bar to filter the table is its own recipe, including the part that usually breaks:

Drill down from a chart into a grid

See the pieces running

Reference documentation

Frequently Asked Questions

What is a JavaScript data grid?

A component that renders tabular data and keeps it interactive at a size where a plain HTML table stops working: it virtualizes rows so only the visible ones exist in the DOM, and it ships sorting, filtering, editing, pinning and keyboard navigation rather than leaving you to build them.

When should I use a plain HTML table instead?

When the data is small, static and read-only. A few hundred rows with no editing, no filtering and no column interaction render fine as a table and cost nothing to ship. A grid earns its bundle size at the point you need virtualization or in-cell editing.

How many column types does ApexGrid have?

Thirteen, as of apex-grid 3.4.0: string, number, boolean, select, rating, date, image, currency, avatar, badge, progress, sparkline and status. A column can also override rendering entirely with a cellTemplate, which receives the cell value and returns a Lit template.

What is the difference between ApexGrid Community and Enterprise?

Community covers the grid itself: virtualization, all 13 column types, sorting, filtering, inline editing, pinning, reordering, selection, tree data and CSV export. Enterprise is a drop-in element that adds the analytics layer: row grouping, aggregations, pivoting, range selection, integrated charts, a formula engine and an AI toolkit. Enterprise requires the Premium or OEM plan.

Does ApexGrid need a framework?

No. It is a standards-based custom element, so it works in plain HTML and in React, Vue or Angular without a wrapper. Its own React, Vue and Angular guides cover the details each framework needs for property binding and events.

Related

Start with ApexGrid

Community covers the whole grid and is free for organizations under $2M in annual revenue.

Get started