我是Angular 4和ngx-datatable
的新手,我陷入困境。现在,我有一个带有简单rowDetail
的ngx-datatable,就像它显示的here一样。问题是我需要rowDetail
包含另一个ngx-datatable
,我不知道这是否可能。
有人能给我一些线索吗?
提前致谢!
答案 0 :(得分:1)
好的,最后根本没什么大不了的。我在这里留下了这种类型的表格的示例模板,因为人们像我一样陷入困境:
<ngx-datatable #myTable class="material expandable" [rows]="rows" [columnMode]="'flex'" [headerHeight]="headerHeight"
[footerHeight]="footerHeight" [rowHeight]="rowHeight" [loadingIndicator]="loadingIndicator" [externalPaging]="true"
[count]="page.totalElements" [offset]="page.pageNumber" [limit]="page.size" (page)='setPage($event)'>
<ngx-datatable-row-detail [rowHeight]="150" #myDetailRow (toggle)="onDetailToggle($event)">
<ng-template let-row="row" let-expanded="expanded" ngx-datatable-row-detail-template>
<div>
<ngx-datatable #myDaughter [columnMode]="'flex'" [headerHeight]="falsey" [rows]="getDetailRows(row)"
[footerHeight]="footerHeight" [rowHeight]="rowHeight" [loadingIndicator]="loadingIndicator" [externalPaging]="true"
[count]="detailRows.length" [offset]="page.pageNumber" [limit]="page.size" (page)='setPage($event)'>
<ngx-datatable-column name="A" prop="col_a"></ngx-datatable-column>
<ngx-datatable-column name="B" prop="col_b"></ngx-datatable-column>
<ngx-datatable-column name="C" prop="col_c"></ngx-datatable-column>
</ngx-datatable>
</div>
</ng-template>
</ngx-datatable-row-detail>
<ngx-datatable-column [sortable]="false" [draggable]="false">
<ng-template let-row="row" let-expanded="expanded" ngx-datatable-cell-template>
<button md-icon-button [class.datatable-icon-right]="!expanded" [class.datatable-icon-down]="expanded" title="Expand/Collapse Row"
(click)="toggleExpandRow(row)"></button>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="A" prop="col_a"></ngx-datatable-column>
<ngx-datatable-column name="B" prop="col_b"></ngx-datatable-column>
<ngx-datatable-column name="C" prop="col_c"></ngx-datatable-column>
</ngx-datatable>