Search code examples
vue.jsvuetify.jsspecial-charactersv-data-table

Search without special characters in vuetify data-table


I use the Vuetify data-table component, and I want to ignore special characters when I make a search. For example in my table I have the polish name "Łukasz", and I want to found it when I type "lukasz". Is it possible ? Thanks


Solution

  • I've found a solution: In my object, I add a value who concatenate the original Name and the name without special chars using latinize.js module:

    import latinize from 'latinize';
    Person.searchLastName = Person.LastName + ' ' + latinize(Person.LastName);

    In the headers object, I use my new value, but I add a template to replace this content by original value like that:

    <template #[`item.Person.searchLastName`]="{ item }">
      <!-- use different value to allow search without special chars -->
      {{item.Person.LastName}}
    </template>