Skip to content

Commit

Permalink
Docs to scroll+resize on TurboTable
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici authored and Çağatay Çivici committed Jan 29, 2018
1 parent f27a993 commit 6fbb54b
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/app/showcase/components/table/tabledemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,33 @@ <h3>Column Resize</h3>
&lt;p-column field="color" header="Color" [style]="&#123;'width':'35%'&#125;"&gt;&lt;/p-column&gt;
&lt;/p-dataTable&gt;
</code>
</pre>

<p><b>Note:</b> Scrollable tables require a column group to support resizing.</p>
<pre>
<code class="language-markup" pCode ngNonBindable>
&lt;p-table [columns]="cols" [value]="cars" [scrollable]="true" scrollHeight="200px" [resizableColumns]="true"&gt;
&lt;ng-template pTemplate="colgroup" let-columns&gt;
&lt;colgroup&gt;
&lt;col *ngFor="let col of columns"&gt;
&lt;/colgroup&gt;
&lt;/ng-template&gt;
&lt;ng-template pTemplate="header" let-columns&gt;
&lt;tr&gt;
&lt;th *ngFor="let col of columns" pResizableColumn&gt;
&#123;&#123;col.header&#125;&#125;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/ng-template&gt;
&lt;ng-template pTemplate="body" let-rowData let-columns="columns"&gt;
&lt;tr&gt;
&lt;td *ngFor="let col of columns"&gt;
&#123;&#123;rowData[col.field]&#125;&#125;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/ng-template&gt;
&lt;/p-table&gt;
</code>
</pre>

<p>See the <a [routerLink]="['/table/colresize']">live example.</a></p>
Expand Down Expand Up @@ -1570,7 +1597,7 @@ <h3>Scrolling</h3>
</code>
</pre>

<p>When column widths need to vary, use colgroup template to avoid misalignment issues and apply percentage values since table width is 100%.</p>
<p>When column widths need to vary or resizable columns is activated, use colgroup template to avoid misalignment issues and apply percentage values since table width is 100%.</p>

<pre>
<code class="language-markup" pCode ngNonBindable>
Expand Down

0 comments on commit 6fbb54b

Please sign in to comment.