[Vuejs]-How to filter exact mach with vuetify v-data-table?

0๐Ÿ‘

โœ…

If you want the exact match, use an == or === for string compare. No need to use indexOf.

methods: {
    filterPerfectMatch(value, search) {
      return value != null && value === search
    },
},

You can also add toLowercase() to value and search, but youโ€™ll need to add checks whether they are strings back.

0๐Ÿ‘

found it was easy af:

 filterPerfectMatch(value, search) {
      if (value == search) {
        console.log("value :" + value + ", search :" + search)
        return value != null &&
        search != null &&
        typeof value === 'string' &&
        value.toString().indexOf(search) !== -1
      }

      
    },

Leave a comment