I am using Dummy JSON API to fetch data. You can replace it with your own API. Checkout Dummy JSON API here
- The Most important project lies in
src/routes/+page.server.ts
file. - here you can query the data from the API and pass it to the
+page.svelte
. - The base of all features lies in
get
,set
andgoto
functions.
- we will be using
limit
&skip
to paginate the data. - default
limit
is 10 andskip
is 0. - when user clicks on the next button, we will increment the
skip
by 10 and fetch the next 10 records. - for specific page, we will calculate the
skip
value and fetch the records. - Checkout Pagination View Component for detail implementation.
- we will be using
throttle-debounce
library to implement the debounce search. - when users inputs the value after
300ms
we will set the query value asq=michael
and fetch the data. - Checkout Search Input Component for detail implementation.
- we will be using
sortBy
&order
query to sort the data. sortBy
will be the key on which we want to sort the data for example id,firstName.order
will be the order of sortingasc
ordesc
.- Checkout Table View Component
- we will be using different fetch url to filter data based on the query.
- here we are using
key
andvalue
to filter the data. - for example
key
='company.title' andvalue
='Sales Manager' - This will provide all the
users
who works in compnay with titleSales Manager
. - Checkout Filter Component for detail implementation.