is it possible to use useEditableTable with a custom resource
is it possible to use useEditableTable with a custom controlled resource. The data and the mutation should be passed manually
2 Replies
Hi @Woods. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, it's possible to use
useEditableTable
with a custom resource. The useEditableTable
hook accepts a resource
property that allows you to specify a custom resource name for API data interactions.
According to the documentation, when you provide a custom resource name that differs from the route resource, you need to be aware of a few things:
1. The syncWithLocation
property will default to false
when a custom resource is provided Link to useEditableTable API
2. For manual data control, you can use the queryOptions
parameter to disable the automatic data fetching and handle it yourself:
For manual mutations, you can use the onMutationSuccess
and onMutationError
callbacks to handle the mutation results:
If you need to manually refetch data after certain events, you can use the tableQueryResult.refetch()
method as mentioned in one of the GitHub issues Link to GitHub issue.
For a completely custom implementation where you want to provide your own data and handle mutations manually, you might want to consider creating a custom data provider as suggested in this GitHub comment.
I hope this helps! Let me know if you need more specific information about implementing this approach.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@567279564028510208> Kapa.ai is still learning and improving, please let me know how I did by reacting below.