Skip to content

Commit

Permalink
Fixed #9621 - Add frozenexpansion template to TurboTable
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Jan 19, 2021
1 parent 305d345 commit fb85656
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable

expandedRowTemplate: TemplateRef<any>;

frozenExpandedRowTemplate: TemplateRef<any>;

frozenHeaderTemplate: TemplateRef<any>;

frozenBodyTemplate: TemplateRef<any>;
Expand Down Expand Up @@ -491,6 +493,10 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
this.frozenColGroupTemplate = item.template;
break;

case 'frozenrowexpansion':
this.frozenExpandedRowTemplate = item.template;
break;

case 'emptymessage':
this.emptyMessageTemplate = item.template;
break;
Expand Down Expand Up @@ -2222,14 +2228,22 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable
<ng-container *ngTemplateOutlet="rowData ? template: dt.loadingBodyTemplate; context: {$implicit: rowData, rowIndex: dt.paginator ? (dt.first + rowIndex) : rowIndex, columns: columns, editing: (dt.editMode === 'row' && dt.isRowEditing(rowData))}"></ng-container>
</ng-template>
</ng-container>
<ng-container *ngIf="dt.expandedRowTemplate">
<ng-container *ngIf="dt.expandedRowTemplate && !(frozen && dt.frozenExpandedRowTemplate)">
<ng-template ngFor let-rowData let-rowIndex="index" [ngForOf]="(dt.paginator && !dt.lazy) ? ((dt.filteredValue||dt.value) | slice:dt.first:(dt.first + dt.rows)) : (dt.filteredValue||dt.value)" [ngForTrackBy]="dt.rowTrackBy">
<ng-container *ngTemplateOutlet="template; context: {$implicit: rowData, rowIndex: dt.paginator ? (dt.first + rowIndex) : rowIndex, columns: columns, expanded: dt.isRowExpanded(rowData), editing: (dt.editMode === 'row' && dt.isRowEditing(rowData))}"></ng-container>
<ng-container *ngIf="dt.isRowExpanded(rowData)">
<ng-container *ngTemplateOutlet="dt.expandedRowTemplate; context: {$implicit: rowData, rowIndex: dt.paginator ? (dt.first + rowIndex) : rowIndex, columns: columns}"></ng-container>
</ng-container>
</ng-template>
</ng-container>
<ng-container *ngIf="dt.frozenExpandedRowTemplate && frozen">
<ng-template ngFor let-rowData let-rowIndex="index" [ngForOf]="(dt.paginator && !dt.lazy) ? ((dt.filteredValue||dt.value) | slice:dt.first:(dt.first + dt.rows)) : (dt.filteredValue||dt.value)" [ngForTrackBy]="dt.rowTrackBy">
<ng-container *ngTemplateOutlet="template; context: {$implicit: rowData, rowIndex: dt.paginator ? (dt.first + rowIndex) : rowIndex, columns: columns, expanded: dt.isRowExpanded(rowData), editing: (dt.editMode === 'row' && dt.isRowEditing(rowData))}"></ng-container>
<ng-container *ngIf="dt.isRowExpanded(rowData)">
<ng-container *ngTemplateOutlet="dt.frozenExpandedRowTemplate; context: {$implicit: rowData, rowIndex: dt.paginator ? (dt.first + rowIndex) : rowIndex, columns: columns}"></ng-container>
</ng-container>
</ng-template>
</ng-container>
<ng-container *ngIf="dt.loading">
<ng-container *ngTemplateOutlet="dt.loadingBodyTemplate; context: {$implicit: columns, frozen: frozen}"></ng-container>
</ng-container>
Expand Down
8 changes: 8 additions & 0 deletions src/app/showcase/components/table/tabledemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ <h3>Templates</h3>
<td>$implicit: Columns</td>
<td>ColGroup element of the table to customize frozen columns.</td>
</tr>
<tr>
<td>frozenrowexpansion</td>
<td>$implicit: Data of the row <br>
rowIndex: Index of the row <br>
columns: Columns collection <br>
</td>
<td>Content of an extended row in frozen side.</td>
</tr>
<tr>
<td>emptymessage</td>
<td>$implicit: Columns <br />
Expand Down

0 comments on commit fb85656

Please sign in to comment.