admin管理员组

文章数量:1335386

This is how is my data table is

<v-data-table
 :search="search"
 :headers="tableHeaders"
 :items="tableItems"
 hide-default-footer
 ></v-data-table>

Is there any way to get the filtered items from data table after search filter is applied. I am passing array in :items which is being filtered by :search.

This is how is my data table is

<v-data-table
 :search="search"
 :headers="tableHeaders"
 :items="tableItems"
 hide-default-footer
 ></v-data-table>

Is there any way to get the filtered items from data table after search filter is applied. I am passing array in :items which is being filtered by :search.

Share Improve this question edited Oct 25, 2019 at 18:07 Akhil K asked Oct 25, 2019 at 14:43 Akhil KAkhil K 981 silver badge7 bronze badges 1
  • Why don't you create a puted variable out of tableItems that filters the items based on your search filter and pass the new variable to the items prop? – Thomas van Broekhoven Commented Oct 25, 2019 at 14:53
Add a ment  | 

1 Answer 1

Reset to default 5

Try to add a handler to @current-items event like :

@current-items="getFiltered"

and add it to your methods as follows:

methods:{
  getFiltered(e){
   console.log(e) //output the filtered items
 }
}

check this codepen

本文标签: javascriptHow to get the filtered array from Vuetify vdatatableStack Overflow