diff --git a/packages/vuetify/src/components/VDataTable/VDataTable.ts b/packages/vuetify/src/components/VDataTable/VDataTable.ts
index 42aca5cd1a1..7da737a50a6 100644
--- a/packages/vuetify/src/components/VDataTable/VDataTable.ts
+++ b/packages/vuetify/src/components/VDataTable/VDataTable.ts
@@ -181,6 +181,9 @@ export default mixins(
return itemsPerPage
},
+ groupByText (): string {
+ return this.headers?.find(header => header.value === this.internalGroupBy?.[0])?.text ?? ''
+ },
},
created () {
@@ -375,7 +378,7 @@ export default mixins(
const column = this.$createElement('td', {
staticClass: 'text-start',
attrs: this.colspanAttrs,
- }, [toggle, `${props.options.groupBy[0]}: ${group}`, remove])
+ }, [toggle, `${this.groupByText}: ${group}`, remove])
children.unshift(this.$createElement('template', { slot: 'column.header' }, [column]))
}
diff --git a/packages/vuetify/src/components/VDataTable/__tests__/__snapshots__/VDataTable.spec.ts.snap b/packages/vuetify/src/components/VDataTable/__tests__/__snapshots__/VDataTable.spec.ts.snap
index cdd410b1f1e..edac3697f47 100644
--- a/packages/vuetify/src/components/VDataTable/__tests__/__snapshots__/VDataTable.spec.ts.snap
+++ b/packages/vuetify/src/components/VDataTable/__tests__/__snapshots__/VDataTable.spec.ts.snap
@@ -6911,7 +6911,7 @@ exports[`VDataTable.ts should render item slot when using group-by function 1`]
- name: Frozen Yogurt
+ Dessert (100g serving): Frozen Yogurt
- name: Ice cream sandwich
+ Dessert (100g serving): Ice cream sandwich
- calories: 159
+ Calories: 159
- calories: 237
+ Calories: 237
- calories: 262
+ Calories: 262
- calories: 305
+ Calories: 305
- calories: 356
+ Calories: 356
- protein: 0
+ Protein (g): 0
- protein: 3.9
+ Protein (g): 3.9
- protein: 4
+ Protein (g): 4
- protein: 4.3
+ Protein (g): 4.3
- name: Assistance
+ Name: Assistance
- name: Candidat
+ Name: Candidat
- name: Candidat
+ Name: Candidat