From 2909d8ad7d58094ddc7b743fe854b64e6754d715 Mon Sep 17 00:00:00 2001 From: LeeWannacott Date: Tue, 30 May 2023 02:11:11 +1200 Subject: [PATCH] WIP fixed missing thead... --- public/index.html | 9 ++++----- public/table-sort.js | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/public/index.html b/public/index.html index 7ec7049..f9cc5c9 100644 --- a/public/index.html +++ b/public/index.html @@ -89,9 +89,8 @@

Testing table containing colspan and data-sort and multiple tbodies

On Our Dates First Sold Out - - + Comedy Show 1 @@ -161,7 +160,6 @@

Testing table containing colspan and data-sort and multiple tbodies

50% 2022-07-31 - Last Name @@ -174,7 +172,7 @@

Testing table containing colspan and data-sort and multiple tbodies

data-sort days dates in dd/mm/yyyy - + Franklin Benjamin @@ -230,6 +228,7 @@

Testing table containing colspan and data-sort and multiple tbodies

Monday 8/6/1978 + Last Name @@ -242,7 +241,7 @@

Testing table containing colspan and data-sort and multiple tbodies

data-sort days dates in dd/mm/yyyy - + Franklin Benjamin diff --git a/public/table-sort.js b/public/table-sort.js index 3475075..cd47d15 100644 --- a/public/table-sort.js +++ b/public/table-sort.js @@ -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"); }