I am using turbo table and want the following:
- Have all columns auto-size based on content.
- Have the table itself fill the screen horizontally eg not manually specify the width
- Have the table horizontally scroll when the auto-sized columns require more space than the table width can provide and without having to specify any column widths manually and also when adding new columns with columns toggle.
from the turbotable example I got:
<p-table [columns]="cols" [value]="cars" [scrollable]="true" scrollHeight="200px"
[style]="{'width':'100%'}">
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col *ngFor="let col of columns" style="width:250px">
</colgroup>
</ng-template>
<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>
<td *ngFor="let col of columns">
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
</p-table>
but I don't want to use the
<col *ngFor="let col of columns" style="width:250px">
here is a plnkr