stormy-gold
stormy-gold3y ago

setFilters for json object

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