Vuetify: [Feature Request] Data table: custom sorting for column

Created on 11 Apr 2018  路  6Comments  路  Source: vuetifyjs/vuetify

Problem to solve

Add ability to define sorting function for column.

Proposed solution

headers: {
  text: string;
  value: string;
  align: 'left' | 'center' | 'right';
  sortable: boolean;
  class: string[] | string;
  width: string;
  sort: (a,b) => {
   //replace with custom algoritm
    if(a>b) return 1
    if(a>b) return -1
    return 0
  }
}
enhancement

Most helpful comment

There's a customSort prop, but it's global (one fn for all headers). It could for example accept the object indexed by header.value, if customSort[...] is not defined then it could use the default sorting method, otherwise use the provided one

All 6 comments

There's a customSort prop, but it's global (one fn for all headers). It could for example accept the object indexed by header.value, if customSort[...] is not defined then it could use the default sorting method, otherwise use the provided one

I have column with Date and column with computed value. And I don't know how to sort it with customSort both.

Available in 2.0 alpha.

is there any workaround for this feature for release "vuetify": "^1.5.1"?

Thanks for reply.
I have implemented custom sorting in my application. It is working fine with the property in data table. But when I use template for header as I am using select-all checkbox, so I need to iterate over the header array.
So by using template for header custom sorting is not working. Even sorting is not working on any column without pagination.
Any suggestion?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chriswa picture chriswa  路  3Comments

jofftiquez picture jofftiquez  路  3Comments

ricardovanlaarhoven picture ricardovanlaarhoven  路  3Comments

itanka9 picture itanka9  路  3Comments

paladin2005 picture paladin2005  路  3Comments