好的,在与gitter上的Teradata人员进行了一些交谈之后,我想出了一个使用
toggle指令
从
共价共模
并将其包含到一个定制的td数据表中,我设法找到了与之相近的东西。
应用程序。组成部分html
<table td-data-table #dataTable>
<thead>
<tr td-data-table-column-row>
<th td-data-table-column
*ngFor="let column of configWidthColumns"
[numeric]="column.numeric">
{{column.label}}
</th>
</tr>
</thead>
<tbody *ngFor="let row of data;let i=index">
<tr class="cursor-pointer" td-data-table-row (click)="toggle(i)">
<td td-data-table-cell *ngFor="let column of configWidthColumns" [numeric]="column.numeric">
{{column.format ? column.format(row[column.name]) : row[column.name]}}
</td>
</tr>
<tr [tdToggle]="toggleDiv[i]">
<td colspan="7">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</td>
</tr>
</tbody>
</table>
应用程序。组成部分ts
toggleDiv: boolean[] = [];
constructor(private _dataTableService: TdDataTableService) {
this.toggleDiv = Array(this.data.length).fill().map((e, i) => true);
}
toggle(i: any): void {
this.toggleDiv[i] = !this.toggleDiv[i];
}
对于任何需要此功能的人,您都可以在上找到完整的实现
stackblitz