Skip to content

Commit

Permalink
Dashboard - table sticky headers
Browse files Browse the repository at this point in the history
Improve the behavior of sticky table headers when used with datatables (iTable). This includes tweaking position to ensure that z-index is relative to the container rather than the viewport as well as removing top margin to prevent a 1 pixel gap when scrolling with a fixed header.
  • Loading branch information
dragonstyle committed Feb 13, 2024
1 parent a7de2e3 commit b797731
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/resources/formats/dashboard/quarto-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function refreshStickyHeaders() {
const iTable = cellOutputNode.querySelector(".itables table");
if (iTable) {
stickyThead.apply([iTable], { scrollableArea: cellOutputNode });
cellOutputNode.classList.add("dashboard-data-table");
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/resources/formats/dashboard/quarto-dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1009,5 +1009,10 @@ $valuebox-colors: (
/*-- itables --*/
.tableFloatingHeaderOriginal {
background-color: $card-bg;
transform: translateY(-1px);
position: sticky !important;
top: 0 !important;
}

.dashboard-data-table {
margin-top: -1px;
}

0 comments on commit b797731

Please sign in to comment.