代码之家  ›  专栏  ›  技术社区  ›  Isaac Obella

可扩展表行td datatable teradata共价

  •  2
  • Isaac Obella  · 技术社区  · 6 年前

    我一直在使用 Teradata Covalent Datatable 为了满足我的表结构需要,在我需要创建一个可扩展的表行之前,它非常简单。我已经搜索并发现 mat-table directly using angular material 为了实现这一点。 enter image description here

    我想知道是否可以使用Teradata共价 td数据表

    1 回复  |  直到 6 年前
        1
  •  4
  •   Isaac Obella    6 年前

    好的,在与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