[Vuejs]-How to apply a filter to only one column in <b-table>

0👍

I had a similar issue and solved it this way. please note, my ‘lists’ is coming frrom store.js
1)create a select input for age filter

<b-input-group>
            <b-form-select v-model="agefilter"  :options="this.$store.state.age">                         
               <option slot="first" :value="null">-- اختر --</option>
             </b-form-select>
           </b-input-group>

2)Inside computed:

 lists() {
            if(this.agefilter!=null)
                 {

                    var filterData = this.$store.getters.lists.filter(data => {
                    return data.age.toString().includes(this.agefilter)
                })
                this.totalRows = filterData.length;
                return filterData; 
                 } else {
                            var filterData =  this.$store.getters.lists
                            this.totalRows = filterData.length;
                            return filterData;
            }
        },

Leave a comment