bigskull
bigskull

Reputation: 581

PrimeNG p-datatable set min width columns

I've a p-datatable responsive and I need to set min-width for each column. This to avoid on resize to have a column width too small. My table is created in this way:

<p-dataTable [value]="listValue" scrollable="true" scrollHeight="200px" [loading]="loading" [responsive]="true">
     <p-column field="first" [style]="{'min-width':'90px'}">
          <ng-template pTemplate="header">
                  <span title="My first Column">My first Column</span>
          </ng-template>
    </p-column>
    ....
</p-dataTable>

It doesn't work. First column became smaller than 90px on resizing page.

Upvotes: 3

Views: 6015

Answers (2)

Maryam
Maryam

Reputation: 69

Like @opt SD said change

.ui-table table {
    table-layout: unset
} 

and then make the min-width to your table headers

Upvotes: 2

Opt SD
Opt SD

Reputation: 21

Check the layout of your current table (table-layout CSS property)

In this case, your table's layout maybe is FIXED, you are not able to set min-width or max-width for the columns.

Upvotes: 1

Related Questions