I want to use a v-text-field
to allow the user to filter the results as they are typing them in for the various rows of the v-data-table
. The <td>
's of the v-data-table
are Arrays also though, which makes the built-in search
functionality of v-data-table
not work. I'm trying to create either a customer filter or some sort of item-key that will help the normal search filter work properly for the nested data within the <td>
. Using "vuetify": "^1.5.16",
and "vue": "^2.6.10"
Codepen Link Here - Vuetify v-data-table help
<div id="app">
<v-app>
<v-layout>
<v-flex xs8 offset-xs2>
<v-text-field
v-model="search"
append-icon="search"
label="Filter Results"
single-line
hide-details
></v-text-field>
</v-flex>
</v-layout>
<v-card>
<v-data-table :items="newCustomerArray"
:headers="headers"
:search="search"
>
<template v-slot:items="props">
<tr :style="{'backgroundColor': props.index % 2 ? 'rgba(31,150,186, 0.2)' : '#fff'}">
<td>
<v-layout column>
<v-flex v-for="(pos, i) in props.item" :key="i" pa-2>
{{ pos.systemCode.code | nullCheck }}
</v-flex>
</v-layout>
</td>
<td>
<v-layout column>
<v-flex v-for="(numberOfPlace, i) in props.item" :key="i" pa-2>
{{ numberOfPlace.numberOfPlace | nullCheck }}
</v-flex>
</v-layout>
</td>
<td>
<v-layout column>
<v-flex v-for="(firstName, i) in props.item" :key="i" pa-2>
{{ firstName.customerName.firstName | nullCheck }}
</v-flex>
</v-layout>
</td>
<td>
<v-layout column>
<v-flex v-for="(lastName, i) in props.item" :key="i" pa-2>
{{ lastName.customerName.lastName | nullCheck }}
</v-flex>
</v-layout>
</td>
<td>
<v-layout column>
<v-flex v-for="(dob, i) in props.item" :key="i" pa-2>
{{ dob.dob | nullCheck }}
</v-flex>
</v-layout>
</td>
<td>
<v-layout column>
<v-flex v-for="(customerContactsPhone, i) in props.item" :key="i" pa-2>
{{ getCustContacts(customerContactsPhone.customerContactsPhone, 'phone') | nullCheck }}
</v-flex>
</v-layout>
</td>
<td>
<v-layout column>
<v-flex v-for="(customerContactsEmail, i) in props.item" :key="i" pa-2>
{{ getCustContacts(customerContactsEmail.customerContactsEmail, 'email') | nullCheck }}
</v-flex>
</v-layout>
</td>
</tr>
</template>
</v-data-table>
</v-app>
</div>