constant-blue
constant-blue2y ago

search multiple antd columns field from search box

how can we search multiple columns field from a search box
8 Replies
refine-support-bot
Hi, I am refine support bot :wave:. I am here to help you with your question. I searched for the answer to your question in the refine documentation and found an answer! 🏆
Answer: You can search multiple columns from a search box by setting the filterOperator property of the column to "contains" and disabling filtering for the column by setting the enableFiltering property of the column to false. SOURCES: ./docs/tutorial/4-adding-crud-pages/antd/adding-sort-and-filters.md ./docs/tutorial/4-adding-crud-pages/headless/adding-sort-and-filters.md ./docs/advanced-tutorials/search/search.md

Note: If this is the answer you need, then we are very lucky. If not, please wait for someone from the refine core team or the community to try to help you.
constant-blue
constant-blue2y ago
how to use conditional filter in antd table to search can u give us simple example of it
foreign-sapphire
foreign-sapphire2y ago
constant-blue
constant-blue2y ago
const { searchFormProps, tableProps } = useTable({ onSearch: (values) => { return [ { field: "title", operator: "contains", value: values.title, }, ]; }, }); i want to add another field in that to filter
foreign-sapphire
foreign-sapphire2y ago
it's array. you can add other values to array
const { searchFormProps, tableProps } = useTable({
onSearch: (values) => {
return [
{
field: "title",
operator: "contains",
value: values.title,
},
{
field: "id",
operator: "eq",
value: values.id,
},
];
},
});
const { searchFormProps, tableProps } = useTable({
onSearch: (values) => {
return [
{
field: "title",
operator: "contains",
value: values.title,
},
{
field: "id",
operator: "eq",
value: values.id,
},
];
},
});
constant-blue
constant-blue2y ago
i want table to be changed while entering values not while clicking on submit
foreign-sapphire
foreign-sapphire2y ago
you can use onValuesChange prop from antd form
<Form {...searchFormProps} onValuesChange={searchFormProps.onFinish} layout='inline'>
<Form {...searchFormProps} onValuesChange={searchFormProps.onFinish} layout='inline'>
constant-blue
constant-blue2y ago
ok thanks