Client mode
Use source.type: "client" when all rows are already in memory. TanStack Table applies filter, sort, and pagination in the browser — no list API round-trip on page change.
<DataTable<Tag>
columns={tagColumns}
source={{ type: "client", data: tags }}
enableToolbar
enablePagination
getRowId={(r) => r.id}
/>
When to use
| Good fit | Poor fit |
|---|---|
| < ~500 rows after load | Large DB tables |
| Data already fetched for a parent form | Need SQL-level filters |
| Modal / drawer row pickers | Deep-linked filters across sessions (optional) |
| Prototyping UI before the API exists | Accurate totals on huge tables |
| Static enums, countries, feature flags | Server-owned authorization on every query |
Behavior
useDataTablesetsserverSide: false- Enables
getFilteredRowModel,getSortedRowModel,getPaginationRowModel - No
useServerTableData/serializeServerTableParams - URL keys (
page,perPage,sort, column filters) still sync unlessdisableParamPersistence - Text filters debounce (~300ms) before updating state
Dialogs (no URL sync)
<DataTable
source={{ type: "client", data: options }}
disableParamPersistence
fillHeight
stickyHeader
enableToolbar
enablePagination
enableRowSelection
/>
disableParamPersistence mounts local state — page/sort/filters stay out of the address bar.
Advanced filters
enableAdvancedFilter works in client mode too (same filters JSON). For dialogs, prefer simple toolbar filters only to keep UX light.
Custom client filterFn
Default text matching is TanStack’s client substring logic (not Postgres iLike). Override per column:
{
id: "name",
accessorKey: "name",
enableColumnFilter: true,
meta: { variant: "text", label: "Name" },
filterFn: (row, id, value) =>
String(row.getValue(id)).toLowerCase().includes(String(value).toLowerCase()),
}
Migrating client → server
- Add Go list + columns endpoints
- Switch
sourcetotype: "server"withfetch/queryKey - Align column
ids with backend - Drop client-only
filterFnoverrides — operators run in SQL