MCPcopy Create free account
hub / github.com/evolify/dumpfun / syncColumnWidths

Function syncColumnWidths

common/hooks/table.ts:50–62  ·  view source on GitHub ↗
(
  table: HTMLTableElement,
  fixedHeader: HTMLDivElement
)

Source from the content-addressed store, hash-verified

48}
49
50function syncColumnWidths(
51 table: HTMLTableElement,
52 fixedHeader: HTMLDivElement
53) {
54 const origThs = table.querySelectorAll("thead th")
55 const cloneThs = fixedHeader.querySelectorAll("th")
56 cloneThs.forEach((th, idx) => {
57 const width = window.getComputedStyle(origThs[idx]).width
58 th.style.width = width
59 })
60 fixedHeader.querySelector("table")!.style.width = `${table.offsetWidth}px`
61 fixedHeader.style.width = `${table.parentElement?.offsetWidth}px`
62}
63
64export function useStickyTable() {
65 const tableRef = useRef<HTMLTableElement>(null)

Callers 1

cloneHeaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected