Как заморозить динамический c выбор строк под заголовком в таблице данных PrimeNG - PullRequest
0 голосов
/ 12 января 2020

Мне удалось заморозить заголовок и столбцы, но теперь необходимо также зафиксировать динамический c выбор строк, которые я хочу отобразить прямо под заголовком.

Вот текущая таблица данных html. Пожалуйста, скажите мне, как я могу добавить к этому.

  <p-table [columns]="store.fields" [value]="playerSeasonStats" [scrollable]="true" [scrollHeight]="tableHeight" frozenWidth="240px">
    <ng-template pTemplate="frozencolgroup" let-columns>
      <colgroup>
        <col style="width:160px">
        <col style="width:80px">
      </colgroup>
    </ng-template>
    <ng-template pTemplate="colgroup" let-columns>
      <colgroup>
        <col style="width:160px">
        <col style="width:160px">
        <col style="width:80px">
        <col style="width:80px">
        <col *ngFor="let col of columns" style="width:100px">
      </colgroup>
    </ng-template>
    <ng-template pTemplate="frozenheader">
      <tr>
        <th style="height:83px" [pSortableColumn]="'player_name'">Name</th>
        <th style="height:83px" [pSortableColumn]="'season'">Season</th>
      </tr>
    </ng-template>
    <ng-template pTemplate="frozenbody" let-rowData>
      <tr>
        <td (click)="toggleAnalyzed(rowData?.player_instatid)">{{rowData['player_name']}}</td>
        <td>{{rowData['season']}}</td>
      </tr>
    </ng-template>
    <ng-template pTemplate="header" let-columns>
      <tr>
        <th [pSortableColumn]="'team_name'">Club</th>
        <th [pSortableColumn]="'league_name'">League</th>
        <th [pSortableColumn]="'primary_position'">Position</th>
        <th [pSortableColumn]="'matches_count'">Matches count</th>
        <th *ngFor="let col of columns" [pSortableColumn]="col">
          {{capitalizeField(col)}}
        </th>
      </tr>
    </ng-template>
    <ng-template pTemplate="body" let-rowData let-columns="columns">
      <tr>
        <td>{{rowData['team_name']}}</td>
        <td>{{rowData['league_name']}}</td>
        <td>{{rowData['primary_position']}}</td>
        <td>{{rowData['matches_count']}}</td>
        <td *ngFor="let col of columns" [ngClass]="colorCondition(rowData, col)">
          {{rowData[col]}}
        </td>
      </tr>
    </ng-template>
  </p-table>
...