Skip to content

Datatable: how to implement simple filters? #171

Answered by sezisfurkan
plweil asked this question in PrimeVue
Discussion options

You must be logged in to vote

Hi,

First, make sure to import the FilterMatchMode from 'primevue/api' in your component.

Next, you should implement the filterSalesTable as a ref like this:

import { FilterMatchMode } from 'primevue/api';

const filterSalesTable = ref({
    global: { value: null, matchMode: FilterMatchMode.CONTAINS }
});

Afterwards, you'll need to add an input area like this:
<InputText type="text" v-model="filterSalesTable.global.value" placeholder="Filter" />
Finally, when using the DataTable component, make sure to pass the filters prop like this:
<DataTable :value="products" v-model:filters="filterSalesTable">
This should help you implement the filtering functionality correctly. If you have any mor…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sezisfurkan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants