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