rising-crimson
rising-crimson15mo ago

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
No description
4 Replies
kapa.ai
kapa.ai15mo ago
Hi @regnregn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai
kapa.ai15mo ago
---------------------- 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:
useSelect({
pagination: {
mode: "server",
},
});
useSelect({
pagination: {
mode: "server",
},
});
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: ----------------------
kapa.ai
kapa.ai15mo ago
<@336843331416096768> kapa.ai is still learning and improving, please let us how it did by reacting below
variable-lime
variable-lime15mo ago
Hey @regnregn, You need to return ‘count’ from your dataProvider.