p-dataTable column size ?

UI Components for Angular
Post Reply
cristhiank
Posts: 9
Joined: 21 Mar 2011, 16:31

30 Jul 2016, 23:43

Hi,

How can I set the column size for a p-dataTable column ?
I'm getting wider columns for short values, I haven't found any property or attribute to achieve this.


Thanks,

Cristhian.

JiroDan
Posts: 20
Joined: 14 Jul 2016, 22:07

03 Aug 2016, 19:08

This works for me:

<p-dataTable [value]="leads" [rows]="20" [paginator]="true" [rowsPerPageOptions]="[5,10,20,50]"
selectionMode="multiple" [(selection)]="selectedLeads" sortMode="multiple"
[totalRecords]="totalRecords" (onLazyLoad)="loadLazy($event)" (onRowDblclick)="leadsDetails($event)">
<p-column [style]="{'width':'14%'}" field="company" header="Company" [sortable]="true"></p-column>
<p-column [style]="{'width':'12%'}" field="name" header="Contact" [sortable]="true"></p-column>
<p-column [style]="{'width':'10%'}" field="city" header="City" [sortable]="true"></p-column>
<p-column [style]="{'width':'10%'}" field="state" header="State" [sortable]="true"></p-column>
<p-column [style]="{'width':'6%'}" field="zip" header="Zip" [sortable]="true"></p-column>
<p-column [style]="{'width':'6%'}" field="tz" header="Timezone" [sortable]="true"></p-column>
</p-dataTable>

loebe
Posts: 7
Joined: 02 Aug 2016, 20:05

04 Aug 2016, 22:06

would be nice to have table-layout: auto;

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests