javascript - How to get the filtered array from Vuetify v-data-table? - Stack Overflow

This is how is my data table is<v-data-table:search="search":headers="tableHeaders&qu

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742389206a4434674.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信