From e0d1140748bb198e12d60e6f3f45e4320f6b3265 Mon Sep 17 00:00:00 2001 From: manasa Date: Thu, 3 Sep 2026 15:57:43 +0530 Subject: [PATCH] Fixed the Angular SDK repeating view heading rendering issue --- .../field-group-template.component.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/angular-sdk-components/src/lib/_components/template/field-group-template/field-group-template.component.ts b/packages/angular-sdk-components/src/lib/_components/template/field-group-template/field-group-template.component.ts index 5dd6368b..c96c0f42 100644 --- a/packages/angular-sdk-components/src/lib/_components/template/field-group-template/field-group-template.component.ts +++ b/packages/angular-sdk-components/src/lib/_components/template/field-group-template/field-group-template.component.ts @@ -43,6 +43,7 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges readonlyMode: boolean; contextClass: any; heading: any; + headingPath: string[] = []; children: any; menuIconOverride$: any; referenceListLength = signal(null); @@ -150,11 +151,24 @@ export class FieldGroupTemplateComponent implements OnInit, OnDestroy, OnChanges return `${heading} ${index + 1}`; }; - getDynamicHeader = (item, index) => { - if (this.heading && item[this.heading.substring(1)]) { - return item[this.heading.substring(1)]; + getDynamicHeader = (item: Record, index: number): string => { + if (this.heading) { + let value: any = item; + this.headingPath = this.heading.substring(1).split('.'); + + for (const key of this.headingPath) { + if (value === null || typeof value !== 'object' || !(key in value)) { + value = undefined; + break; + } + value = Reflect.get(value, key); + } + + if (value !== undefined && value !== null && value !== '') { + return value.toString(); + } } - return `Row ${index + 1}`; + return `${PCore.getLocaleUtils().getLocaleValue('Row', 'SimpleTable')} ${index + 1}`; }; addFieldGroupItem() {