diff --git a/index.html b/index.html
index 6820c37..3b2ab4e 100644
--- a/index.html
+++ b/index.html
@@ -1 +1 @@
-
Manual testing of table sort js
Last Name | First Name | Birth Date | Employee ID | Department | Runtime | File Size | data-sort days | dates in dd/mm/yyyy | file version |
Franklin | Benjamin | 1706-1-17 | 1 | k-level | 1h 1m 17s | 10b | Tuesday | 17/6/1978 | 1.18.1 |
da Vinci | Zarlo | 1452-4-15 | 13000 | | 1m 45s | 192038998987021b | Wednesday | 18/10/2027 | 239.123.23 |
Statham | Jason | 1967-7-26 | | HR | 11m 40s | 134809b | Friday | 4/9/2008 | 3423.342.34 |
Micheal | Angelo | 1958-8-21 | 54 | Marketing | 29s | 30980980b | Thursday | 2/3/1879 | 890.93.908 |
Ben | | 1994/9/23 | 134 | Marketing | 41s | 902938402398b | Monday | 8/6/1978 | 2/3/1879 |
Testing table containing colspan and data-sort and multiple tbodies
| Category | Show | Overall | On Our Dates | On Our Dates | First Sold Out |
---|
|
| Comedy | Show 1 | 18/25 | 72% | 3/4 | 75% | 2 | 1999-7-30 | | Music | Show 2 | 6/10 | 60% | 3/4 | 8 | 75% | 1999-8-04 |
| Theatre | Show 3 | 7/15 | 47% | 3/4 | 75% | 2.12 | 1999-7-19 |
| Comedy | 4 | 10/15 | 67% | 2/3 | 67% | 2.13 | 1999-7-19 |
| Comedy | 5 | 9/12 | 75% | 1/2 | 50% | 2.83 | 1999-7-29 |
| Comedy | 6 | 16/24 | 67% | 2/4 | 50% | 2.83 | 1999-7-26 |
| Comedy | 7 | 16/26 | 62% | 2/4 | 50% | 2.03 | 2022-7-31 |
Last Name | First Name | Birth Date | Employee ID | Department | Runtime | File Size | data-sort days | dates in dd/mm/yyyy |
---|
Franklin | Benjamin | 1706-1-17 | 1,000.00 | k-level | 1h 1m 17s | 10b | Tuesday | 17/6/1978 |
da Vinci | Zarlo | 1452-4-15 | -9,000.21 | | 1m 45s | 192038998987021b | Wednesday | 18/10/2027 |
Statham | Jason | 1967-7-26 | 55,990.23 | HR | 11m 40s | 134809b | Friday | 4/9/2008 |
Micheal | Angelo | 1958-8-21 | 1,000,000.23 | Marketing | 29s | 30980980b | Thursday | 2/3/1879 |
Ben | | 1994/9/23 | 90102 | Marketing | 41s | 902938402398b | Monday | 8/6/1978 |
Last Name | First Name | Birth Date | Employee ID | Department | Runtime | File Size | data-sort days | dates in dd/mm/yyyy |
---|
Franklin | Benjamin | 1706-1-17 | 1 | k-level | 1h 1m 17s | 10b | Tuesday | 17/6/1978 |
da Vinci | Zarlo | 1452-4-15 | 13000 | | 1m 45s | 192038998987021b | Wednesday | 18/10/2027 |
Statham | Jason | 1967-7-26 | | HR | 11m 40s | 134809b | Friday | 4/9/2008 |
Micheal | Angelo | 1958-8-21 | 54 | Marketing | 29s | 30980980b | Thursday | 2/3/1879 |
Ben | | 1994/9/23 | 134 | Marketing | 41s | 902938402398b | Monday | 8/6/1978 |
\ No newline at end of file
+Manual testing of table sort js
Last Name | First Name | Birth Date | Employee ID | Department | Runtime | File Size | data-sort days | dates in dd/mm/yyyy | file version |
---|
Franklin | Benjamin | 1706-1-17 | 1 | k-level | 1h 1m 17s | 10b | Tuesday | 17/6/1978 | 1.18.1 |
---|
da Vinci | Zarlo | 1452-4-15 | 13000 | | 1m 45s | 192038998987021b | Wednesday | 18/10/2027 | 239.123.23 |
---|
Statham | Jason | 1967-7-26 | | HR | 11m 40s | 134809b | Friday | 4/9/2008 | 3423.342.34 |
---|
Micheal | Angelo | 1958-8-21 | 54 | Marketing | 29s | 30980980b | Thursday | 2/3/1879 | 890.93.908 |
---|
Ben | | 1994/9/23 | 134 | Marketing | 41s | 902938402398b | Monday | 8/6/1978 | 2/3/1879 |
---|
Testing table containing colspan and data-sort and multiple tbodies
| Category | Show | Overall | On Our Dates | On Our Dates | First Sold Out |
---|
|
| Comedy | Show 1 | 18/25 | 72% | 3/4 | 75% | 2 | 1999-7-30 | | Music | Show 2 | 6/10 | 60% | 3/4 | 8 | 75% | 1999-8-04 |
| Theatre | Show 3 | 7/15 | 47% | 3/4 | 75% | 2.12 | 1999-7-19 |
| Comedy | 4 | 10/15 | 67% | 2/3 | 67% | 2.13 | 1999-7-19 |
| Comedy | 5 | 9/12 | 75% | 1/2 | 50% | 2.83 | 1999-7-29 |
| Comedy | 6 | 16/24 | 67% | 2/4 | 50% | 2.83 | 1999-7-26 |
| Comedy | 7 | 16/26 | 62% | 2/4 | 50% | 2.03 | 2022-7-31 |
Last Name | First Name | Birth Date | Employee ID | Department | Runtime | File Size | data-sort days | dates in dd/mm/yyyy |
---|
Franklin | Benjamin | 1706-1-17 | 1,000.00 | k-level | 1h 1m 17s | 10b | Tuesday | 17/6/1978 |
da Vinci | Zarlo | 1452-4-15 | -9,000.21 | | 1m 45s | 192038998987021b | Wednesday | 18/10/2027 |
Statham | Jason | 1967-7-26 | 55,990.23 | HR | 11m 40s | 134809b | Friday | 4/9/2008 |
Micheal | Angelo | 1958-8-21 | 1,000,000.23 | Marketing | 29s | 30980980b | Thursday | 2/3/1879 |
Ben | | 1994/9/23 | 90102 | Marketing | 41s | 902938402398b | Monday | 8/6/1978 |
Last Name | First Name | Birth Date | Employee ID | Department | Runtime | File Size | data-sort days | dates in dd/mm/yyyy |
---|
Franklin | Benjamin | 1706-1-17 | 1 | k-level | 1h 1m 17s | 10b | Tuesday | 17/6/1978 |
da Vinci | Zarlo | 1452-4-15 | 13000 | | 1m 45s | 192038998987021b | Wednesday | 18/10/2027 |
Statham | Jason | 1967-7-26 | | HR | 11m 40s | 134809b | Friday | 4/9/2008 |
Micheal | Angelo | 1958-8-21 | 54 | Marketing | 29s | 30980980b | Thursday | 2/3/1879 |
Ben | | 1994/9/23 | 134 | Marketing | 41s | 902938402398b | Monday | 8/6/1978 |
\ No newline at end of file
diff --git a/table-sort.js b/table-sort.js
index 54aca82..300da8b 100644
--- a/table-sort.js
+++ b/table-sort.js
@@ -82,7 +82,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
break;
}
const tableColumn = tr
- .querySelectorAll("td")
+ .querySelectorAll("* > th , * > td")
.item(
column.span[columnIndex] === 1
? column.spanSum[columnIndex] - 1
@@ -125,11 +125,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
headers: [],
};
for (let index of table.theads.keys()) {
- if (table.theads.item(index).querySelectorAll("th").length == 0) {
- table.headers.push(table.theads.item(index).querySelectorAll("td"));
- } else {
- table.headers.push(table.theads.item(index).querySelectorAll("th"));
- }
+ table.headers.push(
+ table.theads.item(index).querySelectorAll("* > th , * > td")
+ );
}
for (let index of table.bodies.keys()) {
if (table.bodies.item(index) == null) {
@@ -200,7 +198,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
};
const numberWithUnitType = /([.0-9]+)\s?(B|KB|KiB|MB|MiB|GB|GiB|TB|TiB)/i;
for (let [i, tr] of table.visibleRows.entries()) {
- let fileSizeTd = tr.querySelectorAll("td").item(columnIndex).textContent;
+ let fileSizeTd = tr
+ .querySelectorAll("* > th , * > td")
+ .item(columnIndex).textContent;
let match = fileSizeTd.match(numberWithUnitType);
if (match) {
let number = parseFloat(match[1]);
@@ -465,7 +465,8 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
"NaN"
);
}
- tr.querySelectorAll("td").item(columnIndex).innerHTML = fileSizeInBytesHTML;
+ tr.querySelectorAll("* > th , * > td").item(columnIndex).innerHTML =
+ fileSizeInBytesHTML;
return table.hasClass.cellsSort ? tr.innerHTML : tr.outerHTML;
}
@@ -532,7 +533,7 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
const column = {
getColumn: function getColumn(tr, colSpanSum, colSpanData) {
return tr
- .querySelectorAll("td")
+ .querySelectorAll("* > th , * > td")
.item(
colSpanData[columnIndex] === 1
? colSpanSum[columnIndex] - 1