Skip to main content

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 fitPoor fit
< ~500 rows after loadLarge DB tables
Data already fetched for a parent formNeed SQL-level filters
Modal / drawer row pickersDeep-linked filters across sessions (optional)
Prototyping UI before the API existsAccurate totals on huge tables
Static enums, countries, feature flagsServer-owned authorization on every query

Behavior​

  • useDataTable sets serverSide: false
  • Enables getFilteredRowModel, getSortedRowModel, getPaginationRowModel
  • No useServerTableData / serializeServerTableParams
  • URL keys (page, perPage, sort, column filters) still sync unless disableParamPersistence
  • 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​

  1. Add Go list + columns endpoints
  2. Switch source to type: "server" with fetch / queryKey
  3. Align column ids with backend
  4. Drop client-only filterFn overrides — operators run in SQL

Examples​