using array of fields in setFilters to search
I want to pass multiple fields in the setFilters, to search the combined first and last name of any person...
onChange={(e: any) =>
setFilters([
{
field: "first_name" + " " + last_name",
value: e?.target?.value,
operator: "startswith",
},
])
}
how can I implement it ??
@Omer
3 Replies
continuing-cyan•2y ago
Hey @coops8, filters are passed to the data provider as query params or in body (depending on the data provider). Looks like the filter you're trying to achieve is depends more on client side filtering which refine does not handle.
You can either pass multiple filters, one for
first_name
and other for last_name
or you can do that filtering in the client side if that covers your case.flat-fuchsia•2y ago
Thanks @aliemirs, yes I'm using client side filtering...
continuing-cyan•2y ago
And if you want to keep using
setFilters
from the hook, you can use filters
which should also be returned from the hook and filter your response with that filter manually 🤔