Skip to content

Commit a5b2603

Browse files
docs(cdk/table): document fixedLayout and recycleRows
1 parent 65330c2 commit a5b2603

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/cdk/table/table.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ updates. This can be based on _anything_: websocket connections, user interactio
135135
time-based intervals, etc. Most commonly, updates will be triggered by user interactions like
136136
sorting and pagination.
137137

138+
##### `fixedLayout`
139+
Native tables calculate column widths from the content within each cell. Because of this, the CDK
140+
table measures the dimensions of sticky elements when its underlying data changes to check if their
141+
widths have also changed. Enabling `fixedLayout` will enforce uniform column widths so the table
142+
can reliably cache their widths. This can reduce rendering latency for large native tables.
143+
144+
```html
145+
<table cdk-table [dataSource]="dataSource" fixedLayout>
146+
```
147+
138148
##### `trackBy`
139149

140150
To improve performance, a `trackBy` function can be provided to the table similar to Angular’s
@@ -145,6 +155,16 @@ table how to uniquely identify rows to track how the data changes with each upda
145155
<table cdk-table [dataSource]="dataSource" [trackBy]="myTrackById">
146156
```
147157

158+
##### `recycleRows`
159+
By default, `CdkTable` creates and destroys an internal Angular view for each row. This allows rows
160+
to participate in animations and to toggle between different row templates with `cdkRowDefWhen`. If
161+
you don't need these features, you can instruct the table to cache and recycle rows by specifying
162+
`recycleRows`.
163+
164+
```html
165+
<table cdk-table [dataSource]="dataSource" recycleRows>
166+
```
167+
148168
### Alternate HTML to using native table
149169

150170
The CDK table does not require that you use a native HTML table. If you want to have full control

0 commit comments

Comments
 (0)