Skip to content

Commit 0c422e2

Browse files
author
Craig Cornelius
authored
Sticky summary table (#505)
* Working on sticky * Make header row sticky in summary dashboard
1 parent a6ee92f commit 0c422e2

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

verifier/summary_template.html

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
p {
2323
margin: 5px 0;
2424
}
25+
2526
</style>
2627
<!-- <script src="validation.js"</script> -->
2728
<script type="text/javascript">
@@ -212,18 +213,29 @@
212213
}
213214
}
214215

215-
let th = table.insertRow();
216-
let td = th.insertCell();
217-
td.innerHTML = "Test Type";
216+
// header row
217+
218+
let tr_header = table.insertRow();
219+
let th = document.createElement("th");
220+
th.className += ' headclass';
221+
tr_header.appendChild(th);
222+
th.innerHTML = "Test Type";
218223

219224
for (const exec of executed_platforms) {
220-
td = th.insertCell();
221-
td.innerHTML = exec;
222-
td.style.textAlign = 'center';
223-
td = th.insertCell();
224-
td.innerHTML = "Details";
225+
let th = document.createElement("th");
226+
th.className += ' headclass';
227+
tr_header.appendChild(th);
228+
th.innerHTML = exec;
229+
th.style.textAlign = 'center';
230+
231+
let th_details = document.createElement("th");
232+
th_details.className += ' headclass';
233+
tr_header.appendChild(th_details);
234+
th_details.innerHTML = "Details";
225235
}
226236

237+
// other rows after header
238+
227239
let background_color;
228240
for (const test_type of test_types) {
229241
tr = table.insertRow();
@@ -321,6 +333,14 @@
321333
td.innerHTML = "%s not tested in %s" % (test_type, exec);
322334
td.style.textAlign = "center";
323335
}
336+
337+
// Unset position style to not conflict with the position: sticky style of the header row
338+
first_div_child = td.getElementsByTagName("div")[0];
339+
first_div_child.style.position = "";
340+
first_div_grandchild = first_div_child.getElementsByTagName("div")[0];
341+
first_div_grandchild.style.position = "";
342+
first_div_grand_grandchild = first_div_grandchild.getElementsByTagName("div")[0];
343+
first_div_grand_grandchild.style.position = "";
324344
}
325345
td = tr.insertCell();
326346
td.innerHTML = details.join('');
@@ -354,6 +374,10 @@
354374
th {
355375
font-weight: bold;
356376
text-align: center;
377+
position: sticky;
378+
top: 0;
379+
background-color: white;
380+
box-shadow: 5px 5px white, -5px 5px white, -5px -5px white, 5px -5px white;
357381
}
358382

359383
#exec_test_table th {

0 commit comments

Comments
 (0)