reactjsprimereact

how to pass filterMatchMode="contains" directly to Column component?


I'm beginning with React and PrimeReact.

In docs https://primereact.org/datatable/#basic_filter they say that to set up options for filters you need to create one object

const [filters, setFilters] = useState({
    global: { value: null, matchMode: FilterMatchMode.CONTAINS },
    name: { value: null, matchMode: FilterMatchMode.STARTS_WITH },
    'country.name': { value: null, matchMode: FilterMatchMode.STARTS_WITH },
    representative: { value: null, matchMode: FilterMatchMode.IN },
    status: { value: null, matchMode: FilterMatchMode.EQUALS },
    verified: { value: null, matchMode: FilterMatchMode.EQUALS }
});

and pass it to <DataTable filters={filters}>

I wonder if there is a way to pass default matchMode directly into <Column /> component?

I tried passing filterMatchMode={FilterMatchMode.CONTAINS} and matchMode="contains" but nothing seems to work.


Solution

  • No, you cannot pass filterMatchMode directly into the component in PrimeReact. The filtering logic is managed through the filters object, which you pass to the component