The whole point of this is to be able to run millions of 'function calls' in a tight loop as fast as possible without writing really horrifyingly deeply nested and impossible to maintain code.
Create a scrollable table with fixed position header.
The entire scrollable table still flows with the rest of the page content.
The header fixed positioning is relative to the scrollable container.