How to integrate server side courses base pagination

Hi,

I'm using server side cursor based pagination. I'm maintaining temporary state for storing data when I click on next course I add data to state when I add data to state the whole table re-render and It takes me to page no 1.

Do I do something wrong?

Hey @Nikhil_Tiwari!

Would you mind sharing some screenshots of how you have your query/table set up, as well as how you're updating your temporary state?

@Kabirdas



Thanks for that! Have you tried using {{ getAllRequest.data.data.results }} as the input value for your table? It aligns better with these docs, you might also want to use the afterCursor property of your table instead of a temp state. Retool will keep a cache of the data that has been fetched in the table's displayedData property:

If that doesn't work you can still accumulate the data yourself but it might be good to do that on top of Retool's built-in pagination handling unless there's a specific issue you've run into with it.

@Kabirdas I tried as you said but the getAllRequest query runs several times and I need to ensure that the two keys responsible for fetching the next page data are being returned by the backend. This is because these keys indicate the availability of additional data, as I don't have access to the total data count.

:thinking: I'm not sure I understand. Do you need both getAllRequest.data.data.lastEvaluatedKey.requestId.s and getAllRequest.data.data.lastEvaluatedKey.createdAt.n to fetch the next page?

yes I need both getAllRequest.data.data.lastEvaluatedKey.requestId.s and getAllRequest.data.data.lastEvaluatedKey.createdAt.n to fetch the next page.

I see. Have you tried storing just one of the values in a temp state and then using the other as your afterCursor?