How to set the pagination for server side pagination
I have set my backend to accommodate _start and _end query for the select method, but from the datagrid, the next page button is greyed out
4 Replies
Hi @regnregn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It seems like you have implemented pagination on your backend, but you might not have configured the frontend to use server-side pagination. In refine, you need to enable server-side pagination for the DataGrid component.
To enable server-side pagination, you can use the
useSelect
hook with the pagination.mode
prop set to "server"
.
Here's an example of how to enable server-side pagination with the useSelect
hook:
Make sure you have implemented the getList
method in your data provider to handle the _start
and _end
query parameters as shown in this example (https://refine.dev/docs/tutorial/understanding-dataprovider/create-dataprovider#3-create-a-data-provider-from-scratch).
If you're still facing issues, please double-check your implementation and ensure that the pagination parameters are being sent correctly to your backend and that the backend is returning the correct data and total count.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------3. Create a data provider from scratch | refine
Introduction
<@336843331416096768> kapa.ai is still learning and improving, please let us how it did by reacting below
fair-rose•17mo ago
Hey @regnregn,
You need to return ‘count’ from your dataProvider.