Skip to content

Commit

Permalink
WIP fixed missing thead...
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeWannacott committed May 29, 2023
1 parent e354eb5 commit 2909d8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ <h2>Testing table containing colspan and data-sort and multiple tbodies</h2>
<th colspan="2" class="data-sort">On Our Dates</th>
<th>First Sold Out</th>
</tr>
</thead>
<tbody>
<tr>
</thead>
<td class="tags"></td>
<td class="category">Comedy</td>
<td class="show_name">Show 1</td>
Expand Down Expand Up @@ -161,7 +160,6 @@ <h2>Testing table containing colspan and data-sort and multiple tbodies</h2>
<td class="pct ours">50%</td>
<td>2022-07-31</td>
</tr>
</tbody>
<thead>
<tr>
<th>Last Name</th>
Expand All @@ -174,7 +172,7 @@ <h2>Testing table containing colspan and data-sort and multiple tbodies</h2>
<th class="data-sort">data-sort days</th>
<th>dates in dd/mm/yyyy</th>
</tr>
</thead>
</thead>
<tr class="table-row-1">
<td>Franklin</td>
<td>Benjamin</td>
Expand Down Expand Up @@ -230,6 +228,7 @@ <h2>Testing table containing colspan and data-sort and multiple tbodies</h2>
<td data-sort="1">Monday</td>
<td>8/6/1978</td>
</tr>
</tbody>
<thead>
<tr>
<th>Last Name</th>
Expand All @@ -242,7 +241,7 @@ <h2>Testing table containing colspan and data-sort and multiple tbodies</h2>
<th class="data-sort">data-sort days</th>
<th>dates in dd/mm/yyyy</th>
</tr>
</thead>
</thead>
<tr class="table-row-1">
<td>Franklin</td>
<td>Benjamin</td>
Expand Down
4 changes: 2 additions & 2 deletions public/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
if (sortableTable.getElementsByTagName("thead").length === 0) {
createMissingTableHead(sortableTable);
if (sortableTable.querySelectorAll("tbody").length > 1) {
// Why index 1?; I don't remember
return sortableTable.querySelectorAll("tbody")[1];
// don't select empty tbody that the browser creates
return sortableTable.querySelectorAll('tbody:not(:nth-child(2))');
} else {
return sortableTable.querySelectorAll("tbody");
}
Expand Down

0 comments on commit 2909d8a

Please sign in to comment.