<div #tableContainer class="worker-container">
  <sm-table #table
            [tableData]="workers"
            [selection]="selectedWorker"
            [reorderableColumns]="false"
            [resizableColumns]="false"
            [scrollable]="true"
            [columns]="cols"
            [rowsNumber]="100"
            [rowHeight]="40"
            (rowSelectionChanged)="onRowClicked($event)"
  >
    <ng-template let-col let-worker="rowData" pTemplate="body">
      <ng-container [ngSwitch]="col.id">
        <ng-container *ngSwitchCase="WORKERS_TABLE_COL_FIELDS.TASK_RUNNING_TIME">
          <span>{{worker?.task?.running_time | msToSec}}</span>
          <span *ngIf="!worker?.task?.running_time">&mdash;</span>
        </ng-container>
        <ng-container *ngSwitchCase="WORKERS_TABLE_COL_FIELDS.ID">
          <span class="first-content" matTooltipPosition="above" [smTooltip]="worker.name">
            {{worker.name}}
          </span>
        </ng-container>
        <ng-container *ngSwitchDefault>
          {{getBodyData(worker, col)}}
          <span *ngIf="(getBodyData(worker, col)!==0) && !getBodyData(worker, col)">&mdash;</span>
        </ng-container>
      </ng-container>
    </ng-template>

    <ng-template let-col pTemplate="sort-filter">
      <sm-table-filter-sort-template
        [class.first]="col.id === WORKERS_TABLE_COL_FIELDS.ID"
        [column]="col"
        [sortOrder]="tableSortFieldsObject[col.id]"
        (sortOrderChanged)="onSortChanged($event, col.id)">
      </sm-table-filter-sort-template>
    </ng-template>
  </sm-table>
</div>



