-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdynamic-table.component.html
More file actions
62 lines (60 loc) · 1.75 KB
/
Copy pathdynamic-table.component.html
File metadata and controls
62 lines (60 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<p-table
[value]="loading() ? [] : data()"
[paginator]="paginator() && !loading()"
[totalRecords]="totalRecords()"
[scrollable]="true"
[first]="page() * rows()"
[rows]="rows()"
[rowsPerPageOptions]="rowsPerPageOptions()"
[lazy]="lazy()"
[lazyLoadOnInit]="false"
(onLazyLoad)="emitLazy($event)"
[tableStyle]="{ width: '100%' }"
>
<!-- Header -->
<ng-template pTemplate="header">
@if (!hideHeader()) {
<tr>
@if (selectable()) {
<th class="selection-col">
<p-tableHeaderCheckbox />
</th>
}
@for (col of columns(); track col.field) {
<th [style.width]="col.width" jhiTranslate="{{ col.header }}"></th>
}
</tr>
}
</ng-template>
<!-- Body -->
<ng-template let-rowData pTemplate="body">
<tr>
@if (selectable()) {
<td>
<p-tableCheckbox [value]="rowData" />
</td>
}
@for (col of columns(); track col.field) {
<td [style.width]="col.width" [ngClass]="{ 'text-center': col.alignCenter ?? false }">
@if (col.template) {
<ng-container *ngTemplateOutlet="col.template; context: { $implicit: rowData }" />
} @else if (col.type === 'date') {
{{ rowData[col.field] | date: 'dd.MM.yyyy' }}
} @else {
{{ rowData[col.field] }}
}
</td>
}
</tr>
</ng-template>
<!-- Empty message while loading -->
<ng-template pTemplate="emptymessage">
@if (loading()) {
<td [attr.colspan]="columns().length + (selectable() ? 1 : 0)">
<div class="flex items-center justify-center py-8">
<jhi-progress-spinner [classStyling]="'w-12 h-12'" [strokeWidth]="'4'" />
</div>
</td>
}
</ng-template>
</p-table>