Skip to content
Advertisement

Vue 2 : how to select just the search results inside v-data-table

I tried to use select all (as a checkbox) to select all result that what I search for, but it’s still selected all data in table and I use employee.map for loop my selection all data in table. Can somebody help me?

here is my code :

JavaScript

if there is anything that I did wrong more than what I expected. I apologize. and Thanks for Helping me.

Advertisement

Answer

I’m not sure about what you want to do, if you want that checkbox to be use to select the employees, or if that checkbox represent a data about the employee (e.g: isVaccinated)

If you want to select the employees: You can use the API of v-data-table: Add a v-model and a show-select to v-data-table:

JavaScript

Then you can delete the field “check” of the employees, the custom checkbox, the methods related to check and uncheck because you don’t need it, everything is handle by v-data-table:

JavaScript

Tell me if it was the solution you expected

Advertisement