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.tsfile. - here you can query the data from the API and pass it to the
+page.svelte. - The base of all features lies in
get,setandgotofunctions.
- we will be using
limit&skipto paginate the data. - default
limitis 10 andskipis 0. - when user clicks on the next button, we will increment the
skipby 10 and fetch the next 10 records. - for specific page, we will calculate the
skipvalue and fetch the records. - Checkout Pagination View Component for detail implementation.
- we will be using
throttle-debouncelibrary to implement the debounce search. - when users inputs the value after
300mswe will set the query value asq=michaeland fetch the data. - Checkout Search Input Component for detail implementation.
- we will be using
sortBy&orderquery to sort the data. sortBywill be the key on which we want to sort the data for example id,firstName.orderwill be the order of sortingascordesc.- Checkout Table View Component
- we will be using different fetch url to filter data based on the query.
- here we are using
keyandvalueto filter the data. - for example
key='company.title' andvalue='Sales Manager' - This will provide all the
userswho works in compnay with titleSales Manager. - Checkout Filter Component for detail implementation.