Sitcky headers without the need of using max-height

Hi everyone

Has anyone found a solution on how to make the table headers sticky, without the need of using max-height? My Knack app is Full Width.

I found Carl Holmes solution:

.kn-table-wrapper {
max-height: 600px;
}

thead {
position: sticky;
z-index: 5;
top: 0;
}

And it works, but unfortunately, I have an action link and when I click on that, it turns a field called “Billed” from No to Yes and vice versa. But everytime I click on that action link, while using the code above, it resets the table scrollbar location to the top and then I have to scroll down again.

If I remove code above, the scrollbar position is not been reset, when an action link is been clicked on, but then I don’t have any sticky headers. I guess a window scrollbar and a table scrollbar behave differently.

So does anyone found a solution to sticky headers, without the need of using max-height or if sticky headers is only possible using max-height, does anyone know to disable the reset scrollbar location, everytime there is an action link that is been clicked on?