setFilters for json object

is there a way to apply nested filters for json b object retuning from usetable , using setFilters
9 Replies
correct-apricot
correct-apricot2y 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
Omer
Omer2y ago
Hey @rehan1 👋, Is there an error you get?
correct-apricot
correct-apricot2y ago
no errors ... but it is filtering table to empty array
Omer
Omer2y ago
If this filter is working in Hasura. You can compare your GraphQL query with the query created by refine ⚡️
correct-apricot
correct-apricot2y 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
Omer
Omer2y ago
Can you compare it with the query generated with refine?
correct-apricot
correct-apricot2y 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
correct-apricot
correct-apricot2y ago
ok is this issue fixed in We've released @pankod/refine-hasura@4.15.0 🎉