dataProvider doesn't take the pagination that passed in the hook
const { tableProps } = useTable<IColor>({
pagination: {
pageSize: 5,
current: 1,
mode: "server",
},
});
i tried to pass pagination to the hook but it doesn't take it somehow
5 Replies
Hi @tuanna_. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The
useTable
hook in refine does support pagination. However, it seems like you're trying to pass the pagination
object directly to the useTable
hook. According to the documentation, the pagination
object should be passed to the tableProps
and then to the Table
component.
Here's an example of how you can do it:
In this example, the pagination
object is spread into the Table
component's pagination
prop. This allows you to override the values of the pagination
object depending on your needs.
If you want to handle pagination on the client side, you can pass the pagination.mode
property and set it to "client". Also, you can disable the pagination by setting it to "off".
For more details, you can refer to the useTable documentation (https://refine.dev/docs/api-reference/antd/hooks/table/useTable/).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@353701348463738885> kapa.ai is still learning and improving, please let us know how it did by reacting below
modern-teal•12mo ago
@kapa.ai oh, seem like it's different from refine mui
Let me check the knowledge base for you. One moment! :books:
----------------------
Yes, you're correct. The way pagination is handled in refine differs between the Ant Design and Material UI versions.
In the Material UI version of refine, the
useAutocomplete
hook is used and pagination is disabled by default. If you want to enable it, you need to set the pagination.mode
prop to "server"
.
Here's an example:
For more details, you can refer to the migration guide from 3.x.x to 4.x.x (https://refine.dev/docs/migration-guide/3x-to-4x/).
Please note that the way you handle pagination might vary based on the specific requirements of your project and the UI library you're using.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@353701348463738885> kapa.ai is still learning and improving, please let us know how it did by reacting below