Migrating from AG Grid to Simple Table (React)
A practical playbook for swapping AG Grid React for Simple Table: how columnDefs map to columns, where sorting, filtering, pinning, and selection live, and a full before/after component.
AG Grid is a capable grid, but row grouping, pivoting, Excel export, and master/detail sit behind an Enterprise license. Simple Table is an MIT-licensed data grid that ships virtualization, column pinning, row grouping with aggregations, pivoting, nested tables, inline editing, and CSV export in one free package.
The two APIs are close enough that most migrations are mechanical: rename a handful of column properties, move a few grid options onto the table, and switch imperative calls from gridRef.current.api to a TableAPI ref. This guide uses React. The same column definitions work in the Vue, Angular, Svelte, Solid, and vanilla TypeScript adapters.
Why migrate
- Grouping, aggregations, pivoting, and nested tables are free under MIT. No Enterprise key to buy or renew.
- One package and one stylesheet. No module registration step.
- Column definitions are plain objects with the same shape in every framework adapter.
- Imperative TableAPI on a ref for export, selection, sorting, filtering, and pagination.
Prerequisites
- A React 18 or newer app that currently renders AgGridReact.
- Rows with a stable id (database id or uuid) for getRowId.
- A list of the AG Grid features each grid uses, so you can check them against the mapping below.
Install
npm install @simple-table/reactBefore: AG Grid React
// EmployeeGrid.tsx (AG Grid React)
import { useMemo, useRef } from "react";
import { AgGridReact } from "ag-grid-react";
import { AllCommunityModule, ModuleRegistry, type ColDef } from "ag-grid-community";
ModuleRegistry.registerModules([AllCommunityModule]);
type Employee = {
id: number;
name: string;
department: string;
salary: number;
startDate: string;
};
export function EmployeeGrid({ rows }: { rows: Employee[] }) {
const gridRef = useRef<AgGridReact<Employee>>(null);
const columnDefs = useMemo<ColDef<Employee>[]>(
() => [
{ field: "name", headerName: "Name", width: 180, pinned: "left" },
{ field: "department", headerName: "Department", flex: 1, filter: "agTextColumnFilter" },
{
field: "salary",
headerName: "Salary",
width: 130,
filter: "agNumberColumnFilter",
valueFormatter: (p) => "$" + Number(p.value).toLocaleString(),
},
{ field: "startDate", headerName: "Start date", width: 140, sort: "desc" },
],
[],
);
return (
<>
<div style={{ height: 400 }}>
<AgGridReact
ref={gridRef}
rowData={rows}
columnDefs={columnDefs}
defaultColDef={{ sortable: true, resizable: true }}
getRowId={(p) => String(p.data.id)}
pagination
paginationPageSize={20}
/>
</div>
<button onClick={() => gridRef.current?.api.exportDataAsCsv()}>Export CSV</button>
</>
);
}After: Simple Table for React
// EmployeeGrid.tsx (Simple Table)
import { useRef } from "react";
import { SimpleTable } from "@simple-table/react";
import type { ReactColumnDef, TableAPI } from "@simple-table/react";
import "@simple-table/react/styles.css";
type Employee = {
id: number;
name: string;
department: string;
salary: number;
startDate: string;
};
const columns: ReactColumnDef<Employee>[] = [
{ accessor: "name", label: "Name", width: 180, pinned: "left", sortable: true, type: "string" },
{
accessor: "department",
label: "Department",
width: "1fr",
sortable: true,
filterable: true,
type: "string",
},
{
accessor: "salary",
label: "Salary",
width: 130,
align: "right",
sortable: true,
filterable: true,
type: "number",
valueFormatter: ({ value }) => `$${Number(value).toLocaleString()}`,
},
{ accessor: "startDate", label: "Start date", width: 140, sortable: true, filterable: true, type: "date" },
];
export function EmployeeGrid({ rows }: { rows: Employee[] }) {
const tableRef = useRef<TableAPI<Employee>>(null);
return (
<>
<SimpleTable
ref={tableRef}
rows={rows}
columns={columns}
getRowId={({ row }) => row.id}
columnResizing
initialSortColumn="startDate"
initialSortDirection="desc"
enablePagination
rowsPerPage={20}
height="400px"
/>
<button onClick={() => tableRef.current?.exportToCSV()}>Export CSV</button>
</>
);
}API mapping cheat sheet
| AG Grid React | Simple Table for React | Notes |
|---|---|---|
rowData | rows | Same array of plain objects. |
columnDefs | columns | Type it as ReactColumnDef<Row>[]. |
ColDef.field | accessor | Dotted paths such as "address.city" work. |
ColDef.headerName | label | Required on every column. |
ColDef.width / flex: 1 | width: 180 / width: "1fr" | width is required. It also accepts "%" values and "auto" to fit content. |
minWidth / maxWidth | minWidth / maxWidth | Same names. |
sortable | sortable: true | Opt in per column. There is no defaultColDef, so spread a shared object if you want the same defaults everywhere. |
ColDef.sort: 'desc' | initialSortColumn + initialSortDirection | Set on the table instead of the column. |
comparator(a, b, nodeA, nodeB, isDesc) | comparator({ rowA, rowB, valueA, valueB, direction }) | Receives whole rows, so sorting by other fields is easy. |
filter: 'agTextColumnFilter' / 'agNumberColumnFilter' / 'agDateColumnFilter' | filterable: true + type: "string" | "number" | "date" | The column type picks the operators. Use type: "enum" with enumOptions for a checkbox list, and filterOperators to limit the choices. |
quickFilterText | quickFilter={{ text }} | Global search across columns, with simple and smart modes. |
pinned: 'left' | 'right' | pinned: "left" | "right" | Same values. |
resizable | columnResizing | Turned on for the whole table. |
editable + onCellValueChanged | editable + onCellEdit | onCellEdit receives { accessor, newValue, row }. |
cellRenderer (ICellRendererParams) | cellRenderer({ row, value, accessor, rowIndex }) | Return any React node. There is no params.data or params.api; use row and a TableAPI ref. |
valueFormatter(params) | valueFormatter({ value, row }) | Return a string or number for display. |
valueGetter(params) | valueGetter({ row, accessor }) | Used for sorting and other operations. |
headerTooltip / cellClass / hide | tooltip / cellClass / hide | cellClass takes a string of class names. |
Column groups (children) | children | Nested headers. Add collapsible: true for collapsible groups. |
getRowId: (p) => p.data.id | getRowId: ({ row }) => row.id | Strongly recommended for editing, selection, and live updates. |
pagination + paginationPageSize | enablePagination + rowsPerPage | serverSidePagination and onPageChange cover server paging. |
rowSelection: { mode: 'multiRow' | 'singleRow' } | enableRowSelection + rowSelectionMode: "multiple" | "single" | onRowSelectionChange replaces onSelectionChanged. |
api.getSelectedRows() | tableRef.current?.getSelectedRowsData() | The ref is a TableAPI directly, with no .api step. |
api.exportDataAsCsv() | tableRef.current?.exportToCSV() | Excel export is not built in. |
onSortChanged / onFilterChanged | onSortChange / onFilterChange | Pair with externalSortHandling or externalFilterHandling for server-side logic. |
domLayout: 'autoHeight' | maxHeight="600px" | The table shrinks to its rows and grows up to the cap. Use height for a fixed size. |
rowGroup + aggFunc (Enterprise) | rowGrouping + aggregation | Free. Expects nested data; see the gotchas below. |
pivotMode (Enterprise) | pivot={{ rows, columns, values }} | Free. Works on flat rows. |
masterDetail (Enterprise) | expandable + nestedTable | Renders a child grid under the expanded row. |
theme={themeQuartz} | theme="light" | "dark" | "modern-light" | ... | Or customTheme and CSS variables. See the theme builder. |
Step-by-step migration
Install Simple Table next to AG Grid
Both libraries can live in the same app while you migrate one grid at a time. Import the stylesheet once, for example in your root layout.
npm install @simple-table/react // app/layout.tsx or main.tsx import "@simple-table/react/styles.css";Convert columnDefs to columns
Rename field to accessor and headerName to label, give every column a width, and add sortable and filterable where you want them. Set type on each column so filters and editors know what they are working with. See sorting, filtering, and pinning.
// Before { field: "salary", headerName: "Salary", flex: 1, filter: "agNumberColumnFilter", pinned: "right" } // After { accessor: "salary", label: "Salary", width: "1fr", filterable: true, sortable: true, type: "number", pinned: "right" }Move grid options onto the table
Swap AgGridReact for SimpleTable. rowData becomes rows, the resizable default becomes columnResizing, and pagination becomes enablePagination with rowsPerPage. Pass height or maxHeight to the table instead of sizing a wrapper div.
Port renderers, formatters, and editing
cellRenderer gets { row, value, accessor, rowIndex } and can return JSX, so most renderers only need their params.data references changed to row. valueFormatter and valueGetter keep their purpose with object arguments. For editing, set editable on the column and handle onCellEdit. See cell renderers and cell editing.
const columns: ReactColumnDef<Employee>[] = [ { accessor: "name", label: "Name", width: 180, editable: true, cellRenderer: ({ row, value }) => <strong title={row.department}>{String(value)}</strong>, }, ]; <SimpleTable rows={rows} columns={columns} getRowId={({ row }) => row.id} onCellEdit={({ accessor, newValue, row }) => save(row.id, accessor, newValue)} />Replace gridRef.current.api calls
Type the ref as TableAPI and call methods on it directly: exportToCSV, getSelectedRowsData, applySortState, applyFilter, setPage, and more. See programmatic control.
const tableRef = useRef<TableAPI<Employee>>(null); tableRef.current?.exportToCSV(); const picked = tableRef.current?.getSelectedRowsData();Remove AG Grid
Once the last grid is moved over, uninstall the AG Grid packages and delete any module registration and theme imports.
npm uninstall ag-grid-react ag-grid-community ag-grid-enterprise
Gotchas
- Sorting and filtering are opt in
- Columns are not sortable or filterable until you set sortable: true or filterable: true. Without a defaultColDef, a shared object spread into each column keeps things short.
- Every column needs a width and a label
- Use a number for pixels, "1fr" to fill like flex: 1, a percentage, or "auto" to fit the content.
- Row grouping expects nested rows
- AG Grid groups flat rows with rowGroup: true. Simple Table groups data that is already nested: rowGrouping lists the child array keys, for example rowGrouping={["teams"]} with each row holding a teams array, and the first column sets expandable: true. If your data is flat and you want a summary, the pivot prop is usually the better fit. See row grouping and pivot.
- Renderers get row, not params.data
- There is no params.node, params.api, or params.context. Read fields from row and call table methods through a TableAPI ref.
- Excel export and integrated charts
- Simple Table exports CSV only and has no charting panel. It does ship lineAreaChart and barChart column types for inline sparklines.
FAQ
- Is Simple Table free for commercial use?
- Yes. Every feature is MIT licensed, including row grouping, aggregations, pivoting, and nested tables. There is no license key.
- Can AG Grid and Simple Table run in the same app during the migration?
- Yes. They are independent packages, so you can move one screen at a time and uninstall AG Grid when the last grid is converted.
- Do I have to rewrite my data layer?
- Usually not. Simple Table takes the same array of plain objects as rowData. The exception is row grouping, which expects child rows nested under the keys listed in rowGrouping.
- Does this guide apply to Vue, Angular, Svelte, or Solid?
- The column definitions and table props are the same in every adapter. Only the component import and renderer syntax change. There is also a dedicated AG Grid Angular guide.