useDataGrid refresh
using useDataGrid , how can I create a function to trigger a data reload event ?
I need something like <RefreshButton> but with lower level code to trigger the data refresh event
2 Replies
Hi @dannywhiteagile. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
In Refine, you can manually trigger a data reload using the
refetch
function provided by the queryResult
or tableQueryResult
returned from the useTable
or useForm
hooks. This can be used in conjunction with useDataGrid
.
Here's an example of how you can use the refetch
function with useTable
:
And here's an example with useForm
:
In these examples, refetch()
is used to manually trigger the API call. You can call this function wherever you need to refresh the data.
Sources:
- Discord support thread: How to re-run useDataGrid? (https://discord.com/channels/837692625737613362/1105974721033555978)
- Discord support thread: useForm (https://discord.com/channels/837692625737613362/1158263375562817566)
- Discord support thread: Refreshing via RefreshButton & On an Interval (https://discord.com/channels/837692625737613362/1127658621724016690)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1129002557419827210> kapa.ai is still learning and improving, please let us know how it did by reacting below