Migrating from @vincjo/datatables

@vincjo/datatables is a small, ergonomic Svelte datatable helper: you wrap your data in a handler and it gives you reactive sorting, filtering, and pagination while you keep your own table markup. SvGrid covers the same job and then keeps going - virtualization, an Excel-style filter menu, inline editing, and a render component - so the port is mostly about deciding how much markup you want to keep.

Estimated effort: 30 min - 2 hours per table. A simple list is a 30-minute swap; a feature-heavy one trends toward two hours.

Vocabulary cheat sheet

@vincjo/datatables sv-grid
new TableHandler(data, { rowsPerPage }) createSvGrid({...}) or <SvGrid>
<ThSort {table} field="name"> rowSortingFeature (header sort built in)
<ThFilter {table} field="name"> columnFilteringFeature
table.global.set(query) (search) api.setGlobalFilter(query)
<Pagination {table} /> / <RowCount> Built in; toggle showPagination
table.rows (current page rows) api.getDisplayedRows()
Server mode (table.load(...)) externalSort / externalFilter + refetch
Your own <table> + {#each table.rows} <SvGrid> render component

Before / after

- <script>
-   import { TableHandler, ThSort, ThFilter, Pagination } from '@vincjo/datatables'
-   const table = new TableHandler(rows, { rowsPerPage: 25 })
- </script>
-
- <table>
-   <thead><tr>
-     <ThSort {table} field="name">Name</ThSort>
-     <ThSort {table} field="amount">Amount</ThSort>
-   </tr></thead>
-   <tbody>
-     {#each table.rows as row}
-       <tr><td>{row.name}</td><td>{row.amount}</td></tr>
-     {/each}
-   </tbody>
- </table>
- <Pagination {table} />

+ <script lang="ts">
+   import {
+     SvGrid, tableFeatures, rowSortingFeature, columnFilteringFeature,
+     type ColumnDef,
+   } from 'sv-grid-community'
+
+   const features = tableFeatures({ rowSortingFeature, columnFilteringFeature })
+   const columns: ColumnDef<typeof features, Row>[] = [
+     { field: 'name',   header: 'Name' },
+     { field: 'amount', header: 'Amount', format: { type: 'currency', currency: 'USD' } },
+   ]
+ </script>
+
+ <SvGrid data={rows} columns={columns} features={features} showPagination />

Server-side data

- // @vincjo/datatables: drive a server with the handler's load hook
- const table = new TableHandler(rows, { rowsPerPage: 25 })
- table.load((state) => fetchRows(state)) // sort/filter/page sent to your API

+ <SvGrid
+   data={rows} columns={columns} features={features}
+   externalSort={true} externalFilter={true}
+   onSortingChange={(clauses) => refetch({ sort: clauses })}
+   onFiltersChange={(f)       => refetch({ filters: f.columns })}
+ />

What you get for free

What you give up

See also

Frequently asked questions

Should I move from @vincjo/datatables to SvGrid?

Move when a hand-rolled table stops being enough - when you need virtualization for large datasets, an Excel-style filter menu, inline editing, grouping, or tree data. For a small sort/filter/paginate list, @vincjo/datatables is a fine, lighter choice.

Is SvGrid also MIT-licensed like @vincjo/datatables?

Yes. sv-grid-community is MIT, like @vincjo/datatables. SvGrid adds an optional paid sv-grid-pro pack (export, import, pivot, AI).

Can I keep my own table markup after switching?

Yes. SvGrid has a headless core (createSvGrid + row-model factories) you can drive with your own markup, the same way @vincjo/datatables lets you. Most teams use the <SvGrid> component instead because it removes the boilerplate.