You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing the list of columns provided to the `<cdk-header-row>` and `<cdk-row>` will automatically
97
-
cause the table to re-render to reflect those changes. For more information, see Dynamic Columns below under Features.
98
+
cause the table to re-render to reflect those changes.
98
99
99
100
### Connecting the table to a data source
100
101
Data is provided to the table through the `DataSource` interface. When the table receives a DataSource,
101
-
it calls its connect function to receive an observable that emits an array of data. Whenever the Data Source emits data to this stream, the table will use it to render its rows.
102
+
it calls the DataSource's connect function which returns an observable that emits an array of data.
103
+
Whenever the Data Source emits data to this stream, the table will use it to render its rows.
102
104
103
105
Since the Data Source provides this data stream, it is responsible for watching for data changes
104
-
and notifying the table when to re-render. Examples of these data changes includes sorting, pagination, filtering, and more.
105
-
To see how these examples can be incorporated in the Data Source, see below under Features.
106
+
and notifying the table when to re-render. Examples of these data changes includes sorting, pagination,
107
+
filtering, and more.
106
108
107
-
Note that a trackBy function can be provided to the table similar to Angular’s ngFor trackBy.
108
-
This allows you to customize how the table to identifies rows and improves performance.
109
+
To improve performance, a trackBy function can be provided to the table similar to Angular’s ngFor trackBy.
110
+
This allows you to customize how the table to identifies rows and helps it to understand how
111
+
the data is changing.
109
112
110
113
In the future, the connect function will be able to use the CollectionViewer parameter to be
111
114
notified about table events, such as what rows the user is currently viewing. This could be used to
112
-
help the Data Source know what data does not need to be retrieved and rendered, further improving performance.
113
-
114
-
## Material Table
115
-
To use the CDK Data Table with styles matching the Material Design spec, you can use the `<md-table>`
116
-
defined in `@angular/material`. This will build on the CDK Data Table and apply built-in Material Design styles.
117
-
118
-
The interface for the `<md-table>` matches the `<cdk-table>`, except that its element selectors
119
-
will be prefixed with `md-` instead of `cdk-`.
120
-
121
-
Note that the column definition directives (`cdkColumnDef` and `cdkHeaderCellDef`) are still prefixed with `cdk-`.
122
-
123
-
```html
124
-
<md-table[dataSource]="dataSource">
125
-
<!-- Column A Definition -->
126
-
<ng-containercdkColumnDef="column_a">
127
-
<md-header-cell*cdkHeaderCellDef> Column A </md-header-cell>
0 commit comments