diff --git a/packages/vuetify/src/components/VDataTable/VDataTable.tsx b/packages/vuetify/src/components/VDataTable/VDataTable.tsx index c98c3ba8147..7bc7b28a138 100644 --- a/packages/vuetify/src/components/VDataTable/VDataTable.tsx +++ b/packages/vuetify/src/components/VDataTable/VDataTable.tsx @@ -156,7 +156,7 @@ export const VDataTable = genericComponent( 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, }) diff --git a/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx b/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx index 898c15e06fc..b2714f7b0d7 100644 --- a/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx +++ b/packages/vuetify/src/components/VDataTable/VDataTableVirtual.tsx @@ -110,7 +110,7 @@ export const VDataTableVirtual = genericComponent item.columns, + transform: item => ({ ...item.raw, ...item.columns }), sortFunctions, sortRawFunctions, }) diff --git a/packages/vuetify/src/components/VDataTable/composables/sort.ts b/packages/vuetify/src/components/VDataTable/composables/sort.ts index d2e316ddf96..03581dac81f 100644 --- a/packages/vuetify/src/components/VDataTable/composables/sort.ts +++ b/packages/vuetify/src/components/VDataTable/composables/sort.ts @@ -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' @@ -148,8 +148,8 @@ export function sortItems ( 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