Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VDataTable): use item.raw and columns in sorting transform #20077

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -155,7 +155,7 @@ export const VDataTable = genericComponent<new <T extends readonly any[], V>(
const { sortByWithGroups, opened, extractRows, isGroupOpen, toggleGroup } = provideGroupBy({ groupBy, sortBy })

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 @@ -109,7 +109,7 @@ export const VDataTableVirtual = genericComponent<new <T extends readonly any[],
const { sortByWithGroups, opened, extractRows, isGroupOpen, toggleGroup } = provideGroupBy({ groupBy, sortBy })

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 @@ -149,8 +149,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
Loading