MCPcopy Index your code
hub / github.com/angular/components / _render

Method _render

src/cdk/table/table.ts:996–1041  ·  view source on GitHub ↗

Renders the table if its state has changed.

()

Source from the content-addressed store, hash-verified

994
995 /** Renders the table if its state has changed. */
996 private _render(): void {
997 // Cache the row and column definitions gathered by ContentChildren and programmatic injection.
998 this._cacheRowDefs();
999 this._cacheColumnDefs();
1000
1001 // Make sure that the user has at least added header, footer, or data row def.
1002 if (
1003 !this._headerRowDefs.length &&
1004 !this._footerRowDefs.length &&
1005 !this._rowDefs.length &&
1006 (typeof ngDevMode === 'undefined' || ngDevMode)
1007 ) {
1008 throw getTableMissingRowDefsError();
1009 }
1010
1011 // Render updates if the list of columns have been changed for the header, row, or footer defs.
1012 const columnsChanged = this._renderUpdatedColumns();
1013 const rowDefsChanged = columnsChanged || this._headerRowDefChanged || this._footerRowDefChanged;
1014 // Ensure sticky column styles are reset if set to `true` elsewhere.
1015 this._stickyColumnStylesNeedReset = this._stickyColumnStylesNeedReset || rowDefsChanged;
1016 this._forceRecalculateCellWidths = rowDefsChanged;
1017
1018 // If the header row definition has been changed, trigger a render to the header row.
1019 if (this._headerRowDefChanged) {
1020 this._forceRenderHeaderRows();
1021 this._headerRowDefChanged = false;
1022 }
1023
1024 // If the footer row definition has been changed, trigger a render to the footer row.
1025 if (this._footerRowDefChanged) {
1026 this._forceRenderFooterRows();
1027 this._footerRowDefChanged = false;
1028 }
1029
1030 // If there is a data source and row definitions, connect to the data source unless a
1031 // connection has already been made.
1032 if (this.dataSource && this._rowDefs.length > 0 && !this._renderChangeSubscription) {
1033 this._observeRenderChanges();
1034 } else if (this._stickyColumnStylesNeedReset) {
1035 // In the above case, _observeRenderChanges will result in updateStickyColumnStyles being
1036 // called when it row data arrives. Otherwise, we need to call it proactively.
1037 this.updateStickyColumnStyles();
1038 }
1039
1040 this._checkStickyStates();
1041 }
1042
1043 /**
1044 * Get the list of RenderRow objects to render according to the current list of data and defined

Callers 2

ngAfterContentCheckedMethod · 0.95
_outletAssignedMethod · 0.95

Calls 9

_cacheRowDefsMethod · 0.95
_cacheColumnDefsMethod · 0.95
_renderUpdatedColumnsMethod · 0.95
_observeRenderChangesMethod · 0.95
_checkStickyStatesMethod · 0.95

Tested by

no test coverage detected