Class: FetchApiDataSource<Data>

index.FetchApiDataSource

Uses the Fetch API to request the data from an api endpoint via HTTP POST requests

Type parameters #

Name
Data

Hierarchy #

Constructors #

constructor #

new FetchApiDataSource<Data>(url, options?)

Create a new data source to fetch your paginated table data from an api endpoint.

The endpoint will receive HTTP POST requests with a json body consisting of an PaginatedListRequest. Your server has to answer with a PaginatedListResponse json body.

Type parameters #

Name
Data

Parameters #

Name Type Description
url string a url to your api endpoint, for example /api/users/list
options RequestInit request init options which get passed directly to fetch

Overrides #

AbstractDataSource.constructor

Defined in #

dataSource/FetchApiDataSource.ts:18

Methods #

getQueryObserver #

getQueryObserver(): Readable<QueryObserver<Data>>

Returns #

Readable<QueryObserver<Data>>

Inherited from #

AbstractDataSource.getQueryObserver

Defined in #

dataSource/AbstractDataSource.ts:26


init #

init(config): void

Parameters #

Name Type
config Required<DataTableConfig<Data>>

Returns #

void

Inherited from #

AbstractDataSource.init

Defined in #

dataSource/AbstractDataSource.ts:22


requestData #

requestData(data): void

Called to retrieve the initial datatable entries and everytime the request changes, for example when the user loads the next page, sorts the entries or searches for something

Parameters #

Name Type Description
data PaginatedListRequest<Data> the request data to be passed through to the server

Returns #

void

Overrides #

AbstractDataSource.requestData

Defined in #

dataSource/FetchApiDataSource.ts:22