javascript - 在表格中使用带有角材料的表格
问题描述
我需要使用Table with expandable rows
角材料。
我的清单有childes
。
如果我的列表childes
有一个值必须是该行expanded
并显示childes
其他行上的项目。
例如 :
这是我的清单,我这样填写:
{
title:'one',
id:1,
childes:
[{
title:'chiled one',
id:2,
childs:null
},
{
title:'chiled one',
id:2,
childs:null
}]
}
这是html:
<table mat-table [dataSource]="dataSource" multiTemplateDataRows class="mat-elevation-z8">
<ng-container matColumnDef="{{column}}" *ngFor="let column of displayedColumns">
<th mat-header-cell *matHeaderCellDef> {{column}} </th>
<td mat-cell *matCellDef="let element"> {{element[column]}} </td>
</ng-container>
<!-- Expanded Content Column - The detail row is made up of this one column that spans across all columns -->
<ng-container matColumnDef="expandedDetail">
<td mat-cell *matCellDef="let element" [attr.colspan]="displayedColumns.length">
<div class="example-element-detail"
[@detailExpand]="element == expandedElement ? 'expanded' : 'collapsed'">
<ng-container matColumnDef="customColumn1">
</div>
</td>
<!-- actions -->
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef>
{{ 'GENERAL.ACTIONS' | translate }}
</th>
<td mat-cell *matCellDef="let row; let i=index;">
<a mat-icon-button [matTooltip]="'TOOLTIP.DETAIL' | translate">
<mat-icon aria-label="Show" (click)="showDetail(row)" class="ic-defualt">remove_red_eye
</mat-icon>
</a>
<a mat-icon-button color="primary" [matTooltip]="'TOOLTIP.EDIT' | translate" uaccess
[routerLink]="['/offline/lesson/',row.courseId,row.id,'edit']">
<mat-icon aria-label="Edit">edit</mat-icon>
</a>
<a mat-icon-button [matTooltip]="'TOOLTIP.COMMENTS' | translate">
<i class="far fa-comments" (click)="goToCommentList(row.title,row.id)"></i>
</a>
<a mat-icon-button [matTooltip]="'TOOLTIP.LIKE' | translate">
<i class="far fa-thumbs-up" (click)="openLikeList(row.id,row.title)"></i>
</a>
<button mat-icon-button color="accent" [matTooltip]="'TOOLTIP.DELETE' | translate" uaccess
(click)="delete(row.id)">
<mat-icon aria-label="Delete">delete</mat-icon>
</button>
</td>
</ng-container>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let element; columns: displayedColumns;" class="example-element-row"
[class.example-expanded-row]="expandedElement === element"
(click)="expandedElement = expandedElement === element ? null : element">
</tr>
<tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr>
</table>
但现在我有这个问题:
childes
当表单为expanded
?????时,我如何显示行中的列表
解决方案
推荐阅读
- spring - @RequestParam 从邮递员返回空值
- windows - SQLite 应用程序在新的 SQLiteConnection Windows 10 v 20H2 上提供 AccessViolation
- python - ARIMA网格搜索python的并行Joblib实现
- android - 在 Flutter 上滚动时 Numberpicker 播放声音
- pip - 当我尝试在 Windows 10 上使用“pip install locust”命令时发生错误
- verilog - Verilog - 比特流在硬件上工作,但模拟无法编译
- javascript - Vue - 访问输入属性内的输入值
- python - 用百分位数重新采样
- performance - 加快批处理模式下联合仿真 Adams/Matlab 的终止过程
- c++ - 使用 unicode 构建示例软件