Filtering
I use operator "in" to filter clients by promocode, but I am not able get default value for promocode after refresh, because filter looks like {field:"id",operator:"in",value:clientIds}. Could you recommend suit approach for this case?
3 Replies
Hi @АлексБог. 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 set the initial value of the filter using the
filters.initial
property in the useTable
hook. This initial value is not permanent and will be cleared when the user changes the filter. If you want to set a permanent value, you can use the filters.permanent
property.
Here is an example of how you can set the initial filter value:
In this example, clientIds
should be an array of the promocodes you want to filter by.
If you want the filter to persist even after the user changes the filter, you can use the filters.permanent
property instead of filters.initial
:
You can find more information about filtering in the refine documentation (https://refine.dev/docs/core/hooks/use-table/#filtering).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1095328021285716009> kapa.ai is still learning and improving, please let us know how it did by reacting below
foreign-sapphire•10mo ago
Hello Aleks, you might need to enable
syncWithLocation
if you want your filters to persist across refreshes:
https://refine.dev/docs/core/refine-component/#syncwithlocation| refine
`` component is the entry point of a refine app. It is where the highest level of configuration of the app occurs.