Datatable: how to implement simple filters? #171
-
I'm new to Prime, and am using only the datatable component. Everything works fine until I try to implement a simple text filter. I'm basically copying the code from the docs, and trying to insert my own data where it seems necessary. But I get a <InputText
v-model="filters['global'].value"
placeholder="Keyword Search"
/> Similarly, I'd like to use a dropdown filter for one column (in my case, each row represents a Can anyone give me a little nudge in the right direction? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, First, make sure to import the Next, you should implement the
Afterwards, you'll need to add an input area like this: |
Beta Was this translation helpful? Give feedback.
Hi,
First, make sure to import the
FilterMatchMode
from 'primevue/api' in your component.Next, you should implement the
filterSalesTable
as aref
like this: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…