Skip to content

Commit 17d103f

Browse files
committed
Sticky header in tables
1 parent ed65b1d commit 17d103f

3 files changed

Lines changed: 40 additions & 5 deletions

File tree

src/ralph/static/src/scss/_overrides.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ select {
8282
float: left;
8383
}
8484
}
85-
.result-list {
86-
overflow-x: auto;
87-
}
88-
8985
.tooltip {
9086
max-width: 600px;
9187
}

src/ralph/static/src/scss/components/bulk_edit.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.bulk-edit #content-main {
2-
overflow-x: auto;
32
.with-tabs {
43
margin-bottom: 60px;
54
}

src/ralph/static/src/scss/components/tables.scss

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,43 @@ table {
105105
}
106106
}
107107
}
108+
109+
#result_list {
110+
thead th {
111+
position: sticky;
112+
top: 0;
113+
z-index: 2;
114+
background: $thead-bg-color;
115+
116+
&:first-child {
117+
left: 0;
118+
z-index: 3;
119+
}
120+
}
121+
122+
tbody tr {
123+
td:first-child,
124+
th:first-child {
125+
position: sticky;
126+
left: 0;
127+
z-index: 1;
128+
}
129+
130+
&:nth-child(even) td:first-child,
131+
&:nth-child(even) th:first-child {
132+
background-color: $row-even-bg-color;
133+
}
134+
&:nth-child(odd) td:first-child,
135+
&:nth-child(odd) th:first-child {
136+
background-color: $row-odd-bg-color;
137+
}
138+
&:nth-child(even):hover td:first-child,
139+
&:nth-child(even):hover th:first-child {
140+
background-color: darken($row-even-bg-color, 1%);
141+
}
142+
&:nth-child(odd):hover td:first-child,
143+
&:nth-child(odd):hover th:first-child {
144+
background-color: darken($row-odd-bg-color, 1%);
145+
}
146+
}
147+
}

0 commit comments

Comments
 (0)