Load method

The load method gives you access to the table state.

table.load((state: State) => myFunction(state): Promise<Row[]> )

Your data fetching function parses the state object to build an API request and returns a set of data.

import type { State } from '@vincjo/datatables/server'
 
table.load(async ({ rowsPerPage, offset, setRowsPerPage }: State) =>  {
    const response = await fetch(`https://myapi.com?limit=${rowsPerPage}&offset=${offset}`)
    return response.json()
})