0
votes

having issues to understand the documentation of vuetifys custom-sort in v-data-table i don't get the customSorters?: custom-sort

docs can be found here: v-data-table

i try to use the custom-sort only when the column row is 'updated_at' or 'created_at' because i have a German date time format when i display the result which comes from a SQL date time format

my column values where the customSort should be used looks like this:

updated_at column

the format is made with moment.js and is 'DD.MM.YYYY - HH:mm:ss' i now need a way to compare these rows in a sort function simple with array.sort() this is what i tried for now:

    customSort(items, sortBy, sortDesc) {
      console.log(sortBy)
      if (sortBy.includes('updated_at')) {
        items = items.map((e) => e.updated_at)
        console.log(items)
        items.sort((a, b) => a - b)
      }

      return items
    }

this is not working at all

1

1 Answers

0
votes

fixed this with help of this post: here

instead of formatting the columns when getting them from the api, i use a v-slot and format them inside the table