filter works in some resources and doesnt work in some other.
also case insensitivity doesn't work. changing filterOperator to containss didnt help.
when filterOperator changed to containss none of the filter is applied.
7 Replies
Hi @Atakan. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the extracts, there are a few potential issues that could be causing your filters to not work as expected.
1. Wrong filter operators: There was a reported bug in the refine-supabase dataProvider where the
contains
and containss
operators were reversed. This means that contains
, which should be case-insensitive, was using the like
operator, which is case-sensitive. Meanwhile, containss
, which should be case-sensitive, was using the ilike
operator, which is case-insensitive. This could be causing your case insensitivity issue. This bug was reported in this Github issue (https://github.com/refinedev/refine/issues/1282).
2. Resetting filter operator: Another reported bug was that the clear button in the filterDropdown resets not just the value but also the operator always to "eq". This makes it impossible to use any other operator after clearing the filter. This bug was reported in this Github issue (https://github.com/refinedev/refine/issues/1386).
3. Incomplete implementation: In the Hasura DataProvider, the handleFilterValue
function does not handle the various contain and similar operators, i.e., not concatenating the '%' character(s). This could be causing your filters to not work as expected. This bug was reported in this Github issue (https://github.com/refinedev/refine/issues/3245).
4. Default operators for filterDropdown: By default, the filterDropdown filters by eq
if it is a simple value or in
if it is an array. The operator could be changed by setting up initialFilter
or permanentFilter
, in which case the filter would use the operator from the initial condition. This feature request was made in this Github issue (https://github.com/refinedev/refine/issues/1199).
Please check if these issues apply to your case. If they do, you might need to update your version of refine or apply the suggested workarounds. If they don't, you might need to provide more specific details about your issue for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@594767835386085376> kapa.ai is still learning and improving, please let us know how it did by reacting below
ambitious-aqua•7mo ago
@Batu can you help me with this?
rare-sapphire•7mo ago
Hey @Atakan we can't help without details. Try to provide a minimal reproducible example for your problem with as much as details. We don't know your UI library, or data provider, nothing. So bot or we can't help.
ambitious-aqua•7mo ago
okay. im using chakra ui.
pageSize=10¤t=1&filters%5B0%5D%5Bfield%5D=country_code&filters%5B0%5D%5Boperator%5D=contains&filters%5B0%5D%5Bvalue%5D=ZW
This is updated url with ZW parameter as contains is the filter. this returns the expected output.
however,
pageSize=10¤t=1&filters%5B0%5D%5Bfield%5D=country_code&filters%5B0%5D%5Boperator%5D=containss&filters%5B0%5D%5Bvalue%5D=zw
when i change the filteroperator to containss with parameter zw the result(ZW) is not displayed. it's case sensitive. i'm trying to make it insensitive
@Batu any ideas?
or let me know if i should provide further details?
rare-sapphire•7mo ago
It might be about your data provider. As I said before, we can't help without minimal reproducible example. Your data provider might be ignoring this filter. We can't really know.
ambitious-aqua•7mo ago
turns out the proplem was with the dataprovider. in backend when name_like="search" was provided the result was not fetched case insensetively. thanks @Batu