vue3-easy-data-table icon indicating copy to clipboard operation
vue3-easy-data-table copied to clipboard

feat(sort): add props for custom sorting

Open jxn-30 opened this issue 1 year ago • 0 comments

This is a feature proposal that adresses #177

The following new props have been added:

  • sort-function
  • multi-sort-function

sort-function

takes the following arguments:

  • a: Item
  • b: Item
  • sortBy: string
  • sortDesc: boolean
  • getItemValue: typeof getItemValueFn
  • defaultSortFunction: (a: Item, b: Item) => number

it should return a number, if a nullish (undefined and null) is returned, the default sort function will automatically be applied.

multi-sort-function

takes the following arguments:

  • sortByArr: string[]
  • sortDescArr: boolean[]
  • itemsToSort: Item[]
  • index: number

it should return an Item[] (Array of Item-Objects). There is no "fallback to default if undefined returned" as for sort-function to allow more controll over the sorting.

jxn-30 avatar Sep 08 '23 15:09 jxn-30