Skip to content

Commit

Permalink
Add sticky headers for big tables (krzysztofslusarski#30)
Browse files Browse the repository at this point in the history
Co-authored-by: Artur Owczarek <[email protected]>
  • Loading branch information
arturowczarek and Artur Owczarek authored Feb 15, 2022
1 parent 79cb9ab commit e2526c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions web-commons/src/main/resources/public/css/welcome.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ td:nth-of-type(n+2) {
font-weight: bold;
}

table.sticky-header thead {
position: sticky;
top: 0;
background-color: white; /* otherwise sticky header labels would have transparent background */
}

.search-input {
width: 100%; /* Full-width */
font-size: 16px; /* Increase font-size */
Expand Down
2 changes: 1 addition & 1 deletion web-commons/src/main/resources/templates/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ <h3 th:if="${content.title != null}">[[${content.title}]]</h3>

</div>
<div th:if="${content.type.name() == 'TABLE'}">
<table class="table table-striped table-bordered table-sm big-font" th:style="'width: ' + ${content.screenWidth} + ';'">
<table th:class="'table table-striped table-bordered table-sm big-font' + ${content.table.size() >= 18 ? ' sticky-header' : ''}" th:style="'width: ' + ${content.screenWidth} + ';'">
<thead th:if="${content.header != null}">
<tr>
<th th:each="column, columnStatus: ${content.header}" th:inline="text">
Expand Down

0 comments on commit e2526c6

Please sign in to comment.