deep-jade
deep-jadeโ€ข2y ago

Question about fetching paginated table data for a .csv export

Hey @Omer , another question if I may. I have a table which will return quite a few records. The table is paginated for obvious reasons. My idea was when they click my button => to get the tableQueryResult.data?.data and then iterate over that to create my data to send to the backend to make the .csv file. Sounds greeat! however in practice, the tableQueryResult.data?.data is only returning the first 50 out of 1500 results.. not the entire resource.. Do i have to create a endpoint to return the unpaginated data .. or can i handle this in refine? I'm kinda stumped as to what to do here, any advice or ideas would be greatly appreciated! Thank you!
6 Replies
Omer
Omerโ€ข2y ago
Hey @ben_g. ๐Ÿ‘‹ ,
deep-jade
deep-jadeโ€ข2y ago
Hey! @Omer ๐Ÿ––
Omer
Omerโ€ข2y ago
You can use hasPagination prop of useTable. So you can handle this in your dataProvider โšก https://github.com/pankod/refine/blob/next/packages/simple-rest/src/index.ts#L104
GitHub
refine/index.ts at next ยท pankod/refine
Build your React-based CRUD applications, without constraints. - refine/index.ts at next ยท pankod/refine
deep-jade
deep-jadeโ€ข2y ago
Thanks @Omer so like make a custom prop that returns the unpaginated data as well ? is that sort of what you might do?
Omer
Omerโ€ข2y ago
You're welcome ๐Ÿป How you handle this will depend on your API design ๐Ÿ’ฏ
deep-jade
deep-jadeโ€ข2y ago
hmmmm yep ok i'll go and have a think, thanks again!