From c5a2863ce29e4a3e06cb91a16d7be4476e6ca642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Akif=20Ay=C3=A7i=C3=A7ek?= <56839946+AkifAycicek@users.noreply.github.com> Date: Sat, 1 Mar 2025 02:13:19 +0300 Subject: [PATCH] fix(DataTable): #7335 When `groupRowsBy` is set to `rowspan` and row expansion is enabled, the last rows in a group would shift left. This was caused by the hidden columns defined in `groupRowsBy`. The issue became more noticeable as more rows were expanded. This fix ensures consistent table layout regardless of row expansion. --- packages/primevue/src/datatable/BodyRow.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/primevue/src/datatable/BodyRow.vue b/packages/primevue/src/datatable/BodyRow.vue index 25a41bafc..eb9c0d22f 100644 --- a/packages/primevue/src/datatable/BodyRow.vue +++ b/packages/primevue/src/datatable/BodyRow.vue @@ -349,6 +349,8 @@ export default { const currentRowFieldData = resolveFieldData(this.value[index], field); let nextRowFieldData = currentRowFieldData; let groupRowSpan = 0; + + if(this.d_rowExpanded) groupRowSpan++; while (currentRowFieldData === nextRowFieldData) { groupRowSpan++; @@ -356,6 +358,12 @@ export default { if (nextRowData) { nextRowFieldData = resolveFieldData(nextRowData, field); + + if(currentRowFieldData === nextRowFieldData){ + const nextRowKeyData = resolveFieldData(nextRowData, this.dataKey); + const isNextRowExpanded = resolveFieldData(this.expandedRows, nextRowKeyData) || this.expandedRows?.some?.((d) => this.equals(nextRowData, d)) + if(isNextRowExpanded) groupRowSpan++; + } } else { break; }