[Vuejs]-Vuetify – How can I use the Data-Table search feature to filter by a dynamically calculated field value?

1👍

Simplest way is to use a computed property:

  computed: {
    employeeTableData() {
      return this.employeesArray.map(e => {
        return {
          email: e.email,
          name: this.getName(e),
          phone: this.getPhone(e),
        };
      });
    },
  },

Then change v-data-table to use employeeTableData instead and directly reference the attributes.

Working codepen

You can then search XD or 666- and it will correctly filter on name and phone number.

👤xlm

Leave a comment