2

I can't get autoLayout to work in the new TurboTable for PrimeNG. All the columns have the same width, regardless of content and the browser width.

I've tried [autoLayout]="true" as well as autoLayout="true". Neither works.

I'm using the latest PrimeNG version (5.2.4)

Here is my html :

<p-card>
    <p-header>
        <div style="padding: 15px; padding-bottom: 0px">
            <button pButton
                    type="button"
                    label="Add New"
                    class="ui-button-info"
                    icon="fa-plus"
                    [routerLink]="['/users/edit', 0]"></button>
        </div>
    </p-header>
    <p-table [columns]="cols"
             [value]="users"
             [autoLayout]="true"
             [(selection)]="selectedUser"
             selectionMode="single"
             [style]="{'height':'600px'}"
             [scrollable]="true"
             scrollHeight="580px"
             [rows]="20"
             (onRowSelect)="handleOnUsersRowSelect($event)">
        <ng-template pTemplate="header" let-columns>
            <tr>
                <th *ngFor="let col of columns">
                    {{col.header}}
                </th>
            </tr>
        </ng-template>
        <ng-template pTemplate="body" let-rowData let-columns="columns">
            <tr [pSelectableRow]="rowData">
                <td *ngFor="let col of columns" style="text-align: center">
                    {{col.field == 'isActive' ? (rowData[col.field] ? 'Yes' : 'No'): rowData[col.field] }}
                </td>
            </tr>
        </ng-template>
    </p-table>
</p-card>
Antikhippe
  • 6,316
  • 2
  • 28
  • 43
Alex
  • 1,353
  • 3
  • 20
  • 31
  • 1
    It looks like the problem occurs if the table is set to scrollable. If it is set to use pages, autolayout works – Alex Apr 11 '18 at 19:03
  • I have the same problem and for now I don't find solution. I can confirm the behavior from the first comment. – makkasi Aug 02 '18 at 14:06
  • 1
    @makkasi I wound up going with pages instead of autoscroll as the autolayout works in that mode. I have not tried it again since the OP nor since upgrading to the latest version of primeng – Alex Aug 03 '18 at 21:13

1 Answers1

5

The scrollable and resizable properties are not compatible with the autoLayout property, for technical reason.

This is documented in PrimeNg site.

tomerpacific
  • 4,704
  • 13
  • 34
  • 52
FChiri
  • 707
  • 8
  • 14