Skip to content

Commit

Permalink
Add thead and tbody to the createTable function (#58)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Criptic authored Jan 3, 2024
1 parent e855c91 commit 10a1e5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sdk/va-report-components/examples/getSelectedData.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ <h1>Currently selected data:</h1>
const tableDiv = document.getElementById("tableDiv");
const table = document.createElement("table");

const tableHeader = document.createElement("thead");
const headingRow = document.createElement("tr");
table.appendChild(headingRow);
tableHeader.appendChild(headingRow)
table.appendChild(tableHeader);

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

const tableBody = document.createElement("tbody");
table.appendChild(tableBody);
// Processing each row of data
for (const dataRow of dataSet.data) {
const row = document.createElement("tr");
table.appendChild(row);
tableBody.appendChild(row);

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

0 comments on commit 10a1e5e

Please sign in to comment.