quickest-silver
quickest-silver15mo ago

Custom data-provider for same resource and "useTable" for different http requests

I need to build a custom data provider for fetching data from my API. My use case requires me to show a table with each table row having a show button. If a show button is pressed, forwards to a different view and renders a new table (loading data by calling a different endpoint). My first table works and I am now trying to trigger the other endpoint and render the second table. As I understand, I need to use the "useTable" hook, which triggers the "getList" method from the dataProvider. Since I can only have 1 getList method in the dataProvider, how can i make this "useTable" hit the http request i need, so i can pass the data with {...tableProps} ? Is it possible to make the "useTable" hook trigger a specific method? I've been through documentation and checking examples but no luck. Any help, please
6 Replies
kapa.ai
kapa.ai15mo ago
Hi @jaco0670. 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
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the refine documentation (https://refine.dev/docs) and refine blog (https://refine.dev/blog) for more information and examples. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Overview | refine
What is refine?
Blog | refine
A Docusaurus powered blog!
kapa.ai
kapa.ai15mo ago
<@486442088280358912> kapa.ai is still learning and improving, please let us how it did by reacting below
continuing-cyan
continuing-cyan15mo ago
@jaco0670 Does the table that pops up after clicking it belong to another resource?
other-emerald
other-emerald15mo ago
@jaco0670 If the other table is another resource then you can create another dataProvider for that. That’s what I am doing too for a similar usecase
quickest-silver
quickest-silver15mo ago
I ended up doing that, yes . Thanks for your help