0

Im using TurboTable with nested TurboTable. On row expand I will retrieve the data from service and bind result in inside the TurboTable. When I use nested TurboTable, TurboTable is not displaying. Im using primeng 5.2.0-rc.2

<p-table [columns]="cols" [value]="cars" dataKey="vin">
    <ng-template pTemplate="header" let-columns>
        <tr>
            <th style="width: 2.25em"></th>
            <th *ngFor="let col of columns">
                {{col.header}}
            </th>
        </tr>
    </ng-template>
    <ng-template pTemplate="body" let-rowData let-expanded="expanded" let-columns="columns">
        <tr>
            <td>
                <a href="#" [pRowToggler]="rowData">
                    <i [ngClass]="expanded ? 'fa fa-fw fa-chevron-circle-down' : 'fa fa-fw fa-chevron-circle-right'"></i>
                </a>
            </td>
            <td *ngFor="let col of columns">
                {{rowData[col.field]}}
            </td>
        </tr>
    </ng-template>
    <ng-template pTemplate="rowexpansion" let-rowData let-columns="columns">
        <tr>
            <td>
              <p-table [value]="cars">
                    <ng-template pTemplate="header">
                        <tr>
                            <th>Vin</th>
                            <th>Year</th>
                            <th>Brand</th>
                            <th>Color</th>
                        </tr>
                    </ng-template>
                    <ng-template pTemplate="body" let-car>
                        <tr>
                            <td>{{car.vin}}</td>
                            <td>{{car.year}}</td>
                            <td>{{car.brand}}</td>
                            <td>{{car.color}}</td>
                        </tr>
                    </ng-template>
            </p-table>
            </td>
        </tr>
    </ng-template>
</p-table>
Antikhippe
  • 6,316
  • 2
  • 28
  • 43
Vignesh
  • 2,378
  • 3
  • 25
  • 48

2 Answers2

0

Dont use the same value property for the main TurboTable and the nested TurboTable... try a different value for the nested turboTable.

0

You can take a look at this example:

https://stackblitz.com/edit/primeng-turbo-table-qaspj4?file=app%2Fexp-table%2Fexp-table.component.html

mfabi
  • 1,038
  • 2
  • 10
  • 18