I have been looking for a way to display filtered results in my table using vue js and axios. When i use an if statement on my table, the filtered results are displayed, but the problem comes in when i export the data because all the results, including the ones that are not filtered are extracted.
I am now filtering the axios response, but the table displays everything from my response. Any tips on methods i can use other than filter to obtain a filtered result will be appreciated.
My table
<v-data-table
:headers="headers1"
:items="new_users"
:rows-per-page-items="rowsPerPage"
:search="search"
:loading="true"
class="elevation-1"
item-key="id"
>
<template slot='no-data'>
<v-progress-linear slot='progress' indeterminate></v-progress-linear>
</template>
<template
slot="items" slot-scope="props">
<!-- v-if="props.item.profile_complete === 0"> -->
<td>{{ props.item.gender }}</td>
<td>{{ props.item.msisdn }}</td>
<td>{{ props.item.email }}</td>
<td>{{ props.item.profile_complete }}</td>
My computed property :
computed: {
filteredList() {
let self = this;
this.new_users = this.users_ttl.filter(item => item.profile_complete === 0);
}
},
My method
getUsers () {
axios.get('users')
.then((response) => {
this.users_ttl = response.data.data
this.loopT(response.data.links.next)
this.isLoading = false
})
.catch((error) => {
console.log(error)
this.error = true
})
},