Skip to content

Commit

Permalink
Sticky table header
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelglenister committed Mar 19, 2024
1 parent aa9ab35 commit 06d35ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions municipal_finance/static/javascript/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@
th.setAttribute('colspan', muniColumns * Math.max(functions.length, 1));
th.setAttribute('title', muni.demarcation_code);
tr.appendChild(th);
$(tr).addClass('sticky-row');
}

// function headings
Expand All @@ -752,6 +753,7 @@
th.innerText = func.label;
th.setAttribute('colspan', cube.columns.length);
tr.appendChild(th);
$(tr).addClass('sticky-row');
});
});
}
Expand All @@ -764,6 +766,7 @@
var th = document.createElement('th');
th.innerText = columns.label;
tr.appendChild(th);
$(tr).addClass('sticky-row');
});
});
}
Expand Down
7 changes: 7 additions & 0 deletions municipal_finance/static/stylesheets/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,19 @@ label {

.table-scroll-area {
overflow: auto;
height:500px;

table {
float: left;
}
}

.sticky-row {
position: sticky;
top: 0;
background-color: #f2f2f2;
}

.values {
th {
font-weight: bold;
Expand Down

0 comments on commit 06d35ae

Please sign in to comment.