Hi, I am trying to build a SPA and having an issue with pagination.
From client side, it is calling back-end function to fetch image url of records and pageSize is 16.
What I am hoping to achieve is to fetch every 16 records whenever user clicks ‘show more photos’ and it will fetch another batch of 16 and so on…
but my question is how can I call fetchNextPage() after it fetches the first batch of records and function’s finished. I have little knowledge of callback function and how it works but if you could help me with this, I’d appreciate it.
What you’re looking for here is an offset value, so when the user clicks “Show more photos” a separate request is made to fetchNextPage() starting where the last request left off (e.g. photo #17 on the second request).
It looks like you’re using the Airtable.js framework for the back-end code based on the code I see, but it’s hard to tell without seeing more. Unfortunately, there’s nothing in the documentation about including offsets in the request using the framework. There is documentation on using it in a cURL request (found in the standard API docs for your base). A lot more detail/discussion can be found in this thread
with the tl;dr being you can add &offset=rec**** to the end of the URL to fetch records starting from that offset.
Thank you Matthew for getting back to me. Yes I am using node.js for fetching data from AT. Haven’t thought about using curl and offset. Will try that and if still not work, will get back to the topic. Thank you