Using two table with one source in one page
I want to call the same tables twices but with different filter in one page.
5 Replies
Hi @M Farhan Zachary. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To display the same table twice on one page with different filters, you can use the
useTable
hook from refine. Below is an example of how you can achieve this:
1. Set up your project: Ensure you have a refine project set up. If not, you can create one using the following command:
2. Create the component: Create a component that will render two tables with different filters.
Here's an example of how you can implement this:
Explanation:
- useTable Hook: We use the useTable
hook twice, each with different initial filters.
- The first useTable
instance filters for posts with the status "published".
- The second useTable
instance filters for posts with the status "draft".
- Rendering Tables: We render two tables, one for each set of filtered data.
This approach ensures that you can display the same table structure with different data based on the filters applied.
For more information on filtering with useTable
, you can refer to the official documentation (https://refine.dev/docs/data/hooks/use-table/#filtering).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@757407865391808603> kapa.ai is still learning and improving, please let us know how it did by reacting below
other-emeraldOP•8mo ago
i am using tables from ant design @kapa.ai
Let me check the knowledge base for you. One moment! :books:
----------------------
To display the same Ant Design table twice on one page with different filters using refine, you can use the
useTable
hook from refine. Below is an example of how you can achieve this:
1. Set up your project: Ensure you have a refine project set up. If not, you can create one using the following command:
2. Create the component: Create a component that will render two Ant Design tables with different filters.
Here's an example of how you can implement this:
Explanation:
- useTable Hook: We use the useTable
hook twice, each with different initial filters.
- The first useTable
instance filters for posts with the status "published".
- The second useTable
instance filters for posts with the status "draft".
- Rendering Tables: We render two Ant Design tables, one for each set of filtered data.
This approach ensures that you can display the same table structure with different data based on the filters applied.
For more information on using the useTable
hook with Ant Design, you can refer to the official documentation (https://refine.dev/docs/ui-integrations/ant-design/hooks/use-table/).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@757407865391808603> kapa.ai is still learning and improving, please let us know how it did by reacting below