I have a vuetify Data-table with multisort enabled like so:
<v-data-table
ref="insuranceTable"
:headers="headers"
:items="getRows"
:sort-by="['created']"
:sort-desc="[true]"
multi-sort
:search="search"
:items-per-page="10"
>
one of the columns in the table is Insurance Type
. this value is fetched by using an index like this {{insuranceType[item.code]}}
. The insuranceType array is defined as follows:
insurancetype:[
this.$t('insuranceType.life'),
this.$t('insuranceType.health'),
this.$t('insuranceType.property'),
]
The values are displayed in the data-table without any issue. However, When I try To sort the table by Insurance Type
Column, nothing happens. The Sorting works for all other columns. The sorting works for Insurance Type
column if I use a non i18n array like this:
insurancetype:['life','health','property']
How can I configure the V-Data-Table
so it can be sorted by columns with i18n values?
items
that have already mappedcode
toinsuranceType
- or provide a custom sorting function to thesort
property in the column definition inheaders
, as shown in the manual – IVO GELOV