vue3-easy-data-table
vue3-easy-data-table copied to clipboard
feat(sort): add props for custom sorting
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.