@@ -152,7 +152,6 @@ export class CdkTable<T> implements CollectionViewer {
152
152
153
153
constructor ( private readonly _differs : IterableDiffers ,
154
154
private readonly _changeDetectorRef : ChangeDetectorRef ,
155
- private readonly _ngZone : NgZone ,
156
155
elementRef : ElementRef ,
157
156
renderer : Renderer2 ,
158
157
@Attribute ( 'role' ) role : string ) {
@@ -166,26 +165,13 @@ export class CdkTable<T> implements CollectionViewer {
166
165
this . _dataDiffer = this . _differs . find ( [ ] ) . create ( this . _trackByFn ) ;
167
166
}
168
167
169
- ngDoCheck ( ) {
170
- // After the the content and view have been initialized and checked then we can connect
171
- // to the data source and render data rows. This cannot be done from within change detection,
172
- // so the table must wait until the next change detection cycle before rendering.
173
- if ( this . _isViewInitialized && this . dataSource && ! this . _renderChangeSubscription ) {
174
- this . _observeRenderChanges ( ) ;
175
- }
176
- }
177
-
178
168
ngAfterContentInit ( ) {
179
169
this . _cacheColumnDefinitionsByName ( ) ;
180
170
this . _columnDefinitions . changes . subscribe ( ( ) => this . _cacheColumnDefinitionsByName ( ) ) ;
181
171
}
182
172
183
173
ngAfterContentChecked ( ) {
184
174
this . _renderUpdatedColumns ( ) ;
185
- this . _cacheColumnDefinitionsByName ( ) ;
186
- }
187
-
188
- ngAfterViewInit ( ) {
189
175
if ( this . dataSource && ! this . _renderChangeSubscription ) {
190
176
this . _observeRenderChanges ( ) ;
191
177
}
@@ -202,17 +188,6 @@ export class CdkTable<T> implements CollectionViewer {
202
188
}
203
189
}
204
190
205
- ngAfterContentInit ( ) {
206
- // TODO(andrewseguin): Throw an error if two columns share the same name
207
- this . _columnDefinitions . forEach ( columnDef => {
208
- this . _columnDefinitionsByName . set ( columnDef . name , columnDef ) ;
209
- } ) ;
210
-
211
- if ( this . dataSource && ! this . _renderChangeSubscription ) {
212
- this . _observeRenderChanges ( ) ;
213
- }
214
- }
215
-
216
191
217
192
/** Update the map containing the content's column definitions. */
218
193
private _cacheColumnDefinitionsByName ( ) {
@@ -231,8 +206,8 @@ export class CdkTable<T> implements CollectionViewer {
231
206
*/
232
207
private _renderUpdatedColumns ( ) {
233
208
// Re-render the rows when the row definition columns change.
234
- this . _rowDefinitions . forEach ( def => {
235
- if ( ! ! def . getColumnsDiff ( ) ) {
209
+ this . _rowDefinitions . forEach ( rowDefinition => {
210
+ if ( ! ! rowDefinition . getColumnsDiff ( ) ) {
236
211
// Reset the data to an empty array so that renderRowChanges will re-render all new rows.
237
212
this . _dataDiffer . diff ( [ ] ) ;
238
213
0 commit comments