Reused generic data table for person network tables
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<div class="mat-elevation-z8">
|
||||
<div [style.max-height]="maxHeight()" [style.overflow]="containerOverflow()">
|
||||
<table
|
||||
mat-table
|
||||
[dataSource]="dataSource"
|
||||
matSort
|
||||
(matSortChange)="onSortChange($event)">
|
||||
(matSortChange)="onSortChange($event)"
|
||||
multiTemplateDataRows>
|
||||
@for (col of columns(); track col.id) {
|
||||
<ng-container [matColumnDef]="col.id">
|
||||
@if (col.type === 'accessor') {
|
||||
@@ -28,10 +29,40 @@
|
||||
</ng-container>
|
||||
}
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns()"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns()"></tr>
|
||||
<ng-container matColumnDef="expandedDetail">
|
||||
<td
|
||||
mat-cell
|
||||
*matCellDef="let row"
|
||||
[attr.colspan]="displayedColumns().length">
|
||||
@if (row === expandedElement() && detailTemplate()) {
|
||||
@if (detailTemplate(); as tpl) {
|
||||
<ng-container
|
||||
*ngTemplateOutlet="
|
||||
tpl;
|
||||
context: { $implicit: row }
|
||||
"></ng-container>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr
|
||||
mat-header-row
|
||||
*matHeaderRowDef="displayedColumns(); sticky: stickyHeader()"></tr>
|
||||
|
||||
<tr
|
||||
mat-row
|
||||
*matRowDef="let row; columns: displayedColumns()"
|
||||
class="element-row"
|
||||
(click)="toggleRow(row)"></tr>
|
||||
|
||||
<tr
|
||||
mat-row
|
||||
*matRowDef="let row; columns: ['expandedDetail']"
|
||||
class="detail-row"
|
||||
[style.display]="row === expandedElement() ? 'table-row' : 'none'"></tr>
|
||||
</table>
|
||||
@if (this.dataSource.data.length === 0) {
|
||||
@if (this.dataSource.filteredData.length === 0) {
|
||||
<div class="no-data">
|
||||
<span>Keine Daten gefunden.</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user