autoLayout not working on TurboTable

UI Components for Angular
Post Reply
aflorin
Posts: 69
Joined: 13 Dec 2017, 19:01

10 Apr 2018, 18:44

I can't get autoLayout to work. 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 primeng 5.2.4

Here is my html:

Code: Select all

<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>
Last edited by aflorin on 11 Apr 2018, 21:02, edited 1 time in total.

aflorin
Posts: 69
Joined: 13 Dec 2017, 19:01

11 Apr 2018, 21:02

The problem seems to occur if you set the table to scrollable. If you set it to use pages, autolayout works correctly

Bonigo
Posts: 1
Joined: 11 Jul 2019, 17:14

11 Jul 2019, 17:18

But if I need to use both - [scrollable]="true" and [autoLayout]="true", what should I do? Thanks

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 22 guests