MCPcopy Create free account
hub / github.com/angular/components / updateStickyHeaderRowStyles

Method updateStickyHeaderRowStyles

src/cdk/table/table.ts:847–866  ·  view source on GitHub ↗

* Updates the header sticky styles. First resets all applied styles with respect to the cells * sticking to the top. Then, evaluating which cells need to be stuck to the top. This is * automatically called when the header row changes its displayed set of columns, or if its * sticky input ch

()

Source from the content-addressed store, hash-verified

845 * of these events.
846 */
847 updateStickyHeaderRowStyles(): void {
848 const headerRows = this._getRenderedRows(this._headerRowOutlet);
849
850 // Hide the thead element if there are no header rows. This is necessary to satisfy
851 // overzealous a11y checkers that fail because the `rowgroup` element does not contain
852 // required child `row`.
853 if (this._isNativeHtmlTable) {
854 const thead = closestTableSection(this._headerRowOutlet, 'thead');
855 if (thead) {
856 thead.style.display = headerRows.length ? '' : 'none';
857 }
858 }
859
860 const stickyStates = this._headerRowDefs.map(def => def.sticky);
861 this._stickyStyler.clearStickyPositioning(headerRows, ['top']);
862 this._stickyStyler.stickRows(headerRows, stickyStates, 'top');
863
864 // Reset the dirty state of the sticky input change since it has been used.
865 this._headerRowDefs.forEach(def => def.resetStickyChanged());
866 }
867
868 /**
869 * Updates the footer sticky styles. First resets all applied styles with respect to the cells

Callers 2

_checkStickyStatesMethod · 0.95

Calls 5

_getRenderedRowsMethod · 0.95
closestTableSectionFunction · 0.85
stickRowsMethod · 0.80
resetStickyChangedMethod · 0.65

Tested by

no test coverage detected