Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions public/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,10 @@ body.list table tbody td.dashboard--table-answer {
margin-top: 2em;
margin-bottom: 2em;
}


/* Fix position of table heads while scrolling */
.affix {
top: 0;
z-index: 1040;
}
19 changes: 19 additions & 0 deletions templates/easy_admin_overrides/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,24 @@
});
}
}, false);

// Function for setting static size on table heads. We need to do this to keep the same width as the table when setting the theads position to fixed.
// One could argue that we should use position sticky instead. But since we manipulate overflow on thead parents that can't be done.
function setTheadSize() {
// Set width of thaed
$("table thead").each(function() {
$(this).width($(this).width());
});
// Set the with of the column headers in thead
$("table thead th").each(function() {
$(this).width($(this).width());
});
// Affix table header when this reaches upper borwser edge.
$('table thead').affix({
offset: 0
})
}
window.addEventListener('resize', setTheadSize);
setTheadSize();
</script>
{% endblock %}