setFilters for json object
is there a way to apply nested filters for json b object retuning from usetable , using setFilters
9 Replies
stormy-goldOP•3y ago
const {tableProps,filters,setFilters} = useTable({
resource:"orders",
metaData:{
fields:[
"patient_name",
"uid",
" order_status",
"order_info",
{provider:["solution","name"]},
{order_items:["provider_catalogue_id"]},
{payments:["order_id","payment_status"]}
] }, }) so here in meta data order_info field is json object setFilters([{ field:"order_info.type", operator:"eq", value:"booked" }],"merge") so i want to filter order_info . type
] }, }) so here in meta data order_info field is json object setFilters([{ field:"order_info.type", operator:"eq", value:"booked" }],"merge") so i want to filter order_info . type
Hey @rehan1 👋,
Is there an error you get?
stormy-goldOP•3y ago
no errors ... but it is filtering table to empty array
If this filter is working in Hasura. You can compare your GraphQL query with the query created by refine ⚡️
stormy-goldOP•3y ago
"message":"field "type" not found in type: 'jsonb_comparison_exp'"}
throwing this error
orders(where: {order_info: {_contains: {type: "somevalue"}})
this way we filter in hasura
Can you compare it with the query generated with refine?
stormy-goldOP•3y ago
order_info
:
{type: {_eq: "Physical"}}
order_info:{type:{_eq:"somevalue"}} this query is generated with refine
order_info:{type:{_eq:"somevalue"}} generated using refine order_info: {_contains: {type: "somevalue"}} using hasura this way
hmm can you create a GitHub issue?
https://github.com/pankod/refine/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5BBUG%5D
stormy-goldOP•3y ago
ok
is this issue fixed in We've released @pankod/refine-hasura@4.15.0 🎉