Skip to content

Commit 10a1e5e

Browse files
authored
Add thead and tbody to the createTable function (#58)
The two thead and tbody put the header row and body rows into groups. This is not required but can improve accessibility for screen readers and can help with styling for libraries like bootstrap
1 parent e855c91 commit 10a1e5e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sdk/va-report-components/examples/getSelectedData.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ <h1>Currently selected data:</h1>
6060
const tableDiv = document.getElementById("tableDiv");
6161
const table = document.createElement("table");
6262

63+
const tableHeader = document.createElement("thead");
6364
const headingRow = document.createElement("tr");
64-
table.appendChild(headingRow);
65+
tableHeader.appendChild(headingRow)
66+
table.appendChild(tableHeader);
6567

6668
// Processing column names
6769
for (const column of dataSet.columns) {
@@ -71,10 +73,12 @@ <h1>Currently selected data:</h1>
7173
headingRow.appendChild(heading);
7274
}
7375

76+
const tableBody = document.createElement("tbody");
77+
table.appendChild(tableBody);
7478
// Processing each row of data
7579
for (const dataRow of dataSet.data) {
7680
const row = document.createElement("tr");
77-
table.appendChild(row);
81+
tableBody.appendChild(row);
7882

7983
// Processing each data value in the row
8084
for (const dataValue of dataRow) {

0 commit comments

Comments
 (0)