fix: display CodeLookup values instead of IDs in datatable view (#2896)
Added empty check: parts[1] && parts[1].trim() to ensure the part after _cd_ exists and is not empty (line)
This commit is contained in:
@@ -31,7 +31,12 @@
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header class="center">
|
||||
{{ 'labels.inputs.Field Name' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let dataTableColumn">{{ dataTableColumn.columnName }}</td>
|
||||
<td mat-cell *matCellDef="let dataTableColumn">
|
||||
{{ getFieldDisplayName(dataTableColumn.columnName) }}
|
||||
@if (datatables.getCodeName(dataTableColumn.columnName)) {
|
||||
<span class="code-name">({{ datatables.getCodeName(dataTableColumn.columnName) }})</span>
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="columnDisplayType">
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code-name {
|
||||
opacity: 0.6;
|
||||
font-size: 0.9em;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ import {
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
import { SystemService } from 'app/system/system.service';
|
||||
import { Datatables } from 'app/core/utils/datatables';
|
||||
|
||||
/** Custom Components */
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
@@ -60,6 +61,7 @@ export class ViewDataTableComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private dialog = inject(MatDialog);
|
||||
private translateService = inject(TranslateService);
|
||||
public datatables = inject(Datatables);
|
||||
|
||||
/** Data Table Data */
|
||||
dataTableData: any;
|
||||
@@ -105,6 +107,13 @@ export class ViewDataTableComponent implements OnInit {
|
||||
this.setColumnsTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get display name for field (e.g., "Actividad" from "ADDRESS_TYPE_cd_ACTIVIDAD")
|
||||
*/
|
||||
getFieldDisplayName(columnName: string): string {
|
||||
return this.datatables.toDisplayLabel(columnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for columns table.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user