Sticky grid header in scrollable panel

Hi,
we’re trying to achieve a sticky header in a grid that is situated in a scrollable panel.

The grid itself should not be scrollable, so we can’t use the built-in sticky header feature of the grid. In our case the grid is moved upwards when the panel is scrolled down. Therefore we want the header to be sticky as soon as it touches the upper border of the panel.
Is there a possibility (or hack) to achieve that?

Greetings,
Johanna