Skip to content

Commit

Permalink
fix(VDataTable): skip default sort if custom function returns null
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Apr 15, 2024
1 parent 6205614 commit d368340
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -143,15 +143,15 @@ export function sortItems<T extends Record<string, any>> (
if (customRawSorters?.[sortKey]) {
const customResult = customRawSorters[sortKey](sortARaw, sortBRaw)

if (!customResult) continue
if (customResult == null) continue

return customResult
}

if (customSorters?.[sortKey]) {
const customResult = customSorters[sortKey](sortA, sortB)

if (!customResult) continue
if (customResult == null) continue

return customResult
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VDataTable/types.ts
Expand Up @@ -5,7 +5,7 @@ import type { provideSelection, SelectableItem } from './composables/select'
import type { FilterFunction, InternalItem } from '@/composables/filter'
import type { SelectItemKey } from '@/util'

export type DataTableCompareFunction<T = any> = (a: T, b: T) => number
export type DataTableCompareFunction<T = any> = (a: T, b: T) => number | null

export type DataTableHeader<T = Record<string, any>> = {
key?: 'data-table-group' | 'data-table-select' | 'data-table-expand' | (string & {})
Expand Down

0 comments on commit d368340

Please sign in to comment.