ambitious-aqua
ambitious-aqua6mo ago

Filter resets automatically

Hey There, when calling the the search function of the useDatagrid Hook, the filter executes in firing the correct query. However there is a second query fired right afterwards, without the corresponding filter Parameters... I will attach a short video of the problem...
3 Replies
kapa.ai
kapa.ai6mo ago
Hi @zaibatsu84. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not contain specific details about the issue you're experiencing with the useDataGrid hook in refine. However, I can suggest that you ensure you're using the setFilters function correctly. According to the refine documentation (https://refine.dev/docs/ui-integrations/material-ui/hooks/use-data-grid#filtering), you can use setFilters to filter externally from the <DataGrid> component. Also, you might want to check the filters.defaultBehavior property. As per the documentation (https://refine.dev/docs/ui-integrations/material-ui/hooks/use-data-grid#filtersdefaultbehavior), the filtering behavior can be set to either "merge" or "replace". If it's set to "merge", it will merge the new filter with the existing filters. If it's set to "replace", it will replace all existing filters with the new filter. If the issue persists, I recommend reaching out to the refine community or checking the official documentation (https://refine.dev/docs) for more information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6mo ago
<@791378338856828959> kapa.ai is still learning and improving, please let us know how it did by reacting below
ambitious-aqua
ambitious-aqua6mo ago
Actually i am using the "onSearch" Event of the useDatagrid Hook. const { dataGridProps, search } = useDataGrid({ onSearch:HumanaUtils.dataGridSearch }); i also verified that the onSearch Event is only executed once, leading to the correct request.