Migrate to server-side data
Migrate to server-side data
Use this checklist when moving from a full in-memory data array and hooks such as afterChange to dataProvider. For an overview and demo, see Server-side data.
Checklist
- Stable row ids — Set
rowIdto a property name (for example'id') or a function. Every row from the server must include that field. fetchRows— Replace ad hocloadDatacalls withfetchRows(queryParameters, { signal }). Readpage,pageSize,sort, andfiltersfromqueryParameters, call your API, return{ rows, totalRows }, and honorsignalfor cancellation. Drop or stop updating the olddataarray; with a complete provider, it is not used.- CRUD callbacks — Implement
onRowsCreate,onRowsUpdate, andonRowsRemovefor your backend. Until all three are valid functions (withrowIdandfetchRows), the configuration is incomplete. Details: Create, update, and remove. - Pagination and sort — Set
paginationtotrueor pass an object (for example{ pageSize: 10 }sofetchRowsreceives thatpageSizeinqueryParameters). UsecolumnSortingfor single-column server sort. KeepmultiColumnSorting,trimRows,manualRowMove, andmanualColumnMoveoff if you need DataProvider to run; when any of them is truthy, the DataProvider plugin does not enable (see Plugins and options that conflict with DataProvider). - Save hooks — If you only used
afterChangeto POST each edit, remove that and rely ononRowsUpdatebatches instead. Keep unrelated hooks (validation UI, analytics, etc.). - Filters (optional) — Enable
filtersand translatequeryParameters.filterson the server. See Column filter. - Frameworks — Pass
dataProviderinside grid settings (HotTable,hot-table, or Vue:settings). AfterupdateSettingsin React, preserve selection withselection.exportSelection()andselection.importSelection()on the Handsontable instance where your wrapper documents it.
More in this guide
- Server-side data — overview, quick start, and demo.
- Configuration and query parameters
- Create, update, and remove
- Fetching, hooks, and examples