broad-salmonB
Refineโ€ข4y agoโ€ข
18 replies
broad-salmon

onSearch function to run of useTable

const {tableProps,filters,setFilters,searchFormProps } = useTable({
resource:"orders",
hasPagination:false,

metaData:{
fields:[
"patient_name",
"uid",
" order_status",
"order_info",
{provider:["solution","name"]},
{order_items:["provider_catalogue_id"]},
{payments:["order_id","payment_status"]}

]
},
onSearch:(value:any)=>[

{
operator:"or",
value:[
{
field:"patient_name",
operator:"startswith",
value:"aysha",
},
{
field:"order_status",
operator:"startswith",
value:%${value.q.toLowerCase()}%,
}
]
}
],

permanentFilter:[
{
field:"order_items.provider_catalogue_id",
value:"086c0d6b-6e81-4099-8f30-0355cad4dd29",
operator:"eq"},
{
field:"provider.solution",
value:"clinic",
operator:"eq"},

],
defaultSetFilterBehavior: "replace",


})
i want to run this onserach function of usetable whenever the value of input changes how to do it?
Was this page helpful?