Skip to content

Commit

Permalink
fix(VDataTable): use item.raw and columns in sorting transform (#20077)
Browse files Browse the repository at this point in the history
fixes #20045
  • Loading branch information
tongxuanbao authored Jul 16, 2024
1 parent a88a2ee commit e33b951
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VDataTable/VDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const VDataTable = genericComponent<new <T extends readonly any[], V>(
const { sortByWithGroups, opened, extractRows, isGroupOpen, toggleGroup } = provideGroupBy({ groupBy, sortBy, disableSort })

const { sortedItems } = useSortedItems(props, filteredItems, sortByWithGroups, {
transform: item => item.columns,
transform: item => ({ ...item.raw, ...item.columns }),
sortFunctions,
sortRawFunctions,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const VDataTableVirtual = genericComponent<new <T extends readonly any[],
const { sortByWithGroups, opened, extractRows, isGroupOpen, toggleGroup } = provideGroupBy({ groupBy, sortBy, disableSort })

const { sortedItems } = useSortedItems(props, filteredItems, sortByWithGroups, {
transform: item => item.columns,
transform: item => ({ ...item.raw, ...item.columns }),
sortFunctions,
sortRawFunctions,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useProxiedModel } from '@/composables/proxiedModel'

// Utilities
import { computed, inject, provide, toRef } from 'vue'
import { isEmpty, propsFactory } from '@/util'
import { getObjectValueByPath, isEmpty, propsFactory } from '@/util'

// Types
import type { InjectionKey, PropType, Ref } from 'vue'
Expand Down Expand Up @@ -148,8 +148,8 @@ export function sortItems<T extends InternalItem> (

if (sortOrder === false) continue

let sortA = a[1][sortKey]
let sortB = b[1][sortKey]
let sortA = getObjectValueByPath(a[1], sortKey)
let sortB = getObjectValueByPath(b[1], sortKey)
let sortARaw = a[0].raw
let sortBRaw = b[0].raw

Expand Down

0 comments on commit e33b951

Please sign in to comment.