diff --git a/README.md b/README.md
index 17c318e..db2fd02 100755
--- a/README.md
+++ b/README.md
@@ -6,7 +6,11 @@
Makes any table with **class="sortable"**, er, sortable. The user can click on a table header and change the sorting of the table rows.
-Just include the JavaScript and it will work. No function calls are needed, everything is handled by an **eventListener**.
+Just include the JavaScript and it will work. No function calls are needed, everything is handled by a [JavaScript HTML DOM EventListener](https://www.w3schools.com/js/js_htmldom_eventlistener.asp).
+
+
Related Projects
+
+🔍 **[searchable](https://github.com/tofsjonas/searchable)** - A companion library that makes tables searchable/filterable, perfect to use alongside sortable!
Demo
diff --git a/dist/auto.html b/dist/auto.html
deleted file mode 100644
index 3b4bde8..0000000
--- a/dist/auto.html
+++ /dev/null
@@ -1,372 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/auto.min.html b/dist/auto.min.html
deleted file mode 100644
index 82a01d7..0000000
--- a/dist/auto.min.html
+++ /dev/null
@@ -1,372 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/bundled.html b/dist/bundled.html
deleted file mode 100644
index 12470d3..0000000
--- a/dist/bundled.html
+++ /dev/null
@@ -1,373 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/bundled.min.html b/dist/bundled.min.html
deleted file mode 100644
index 2140440..0000000
--- a/dist/bundled.min.html
+++ /dev/null
@@ -1,373 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/esm.html b/dist/esm.html
deleted file mode 100644
index 35cee2a..0000000
--- a/dist/esm.html
+++ /dev/null
@@ -1,375 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/esm.min.html b/dist/esm.min.html
deleted file mode 100644
index ca4ac8d..0000000
--- a/dist/esm.min.html
+++ /dev/null
@@ -1,375 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/example.css b/dist/example.css
index 6b8861c..aeabdac 100644
--- a/dist/example.css
+++ b/dist/example.css
@@ -72,18 +72,18 @@
vertical-align: baseline;
white-space: nowrap;
}
-.sortable td,
-.sortable th {
- padding: 10px;
-}
-.sortable td:first-child,
-.sortable th:first-child {
+.sortable thead td:first-child,
+.sortable thead th:first-child {
border-top-left-radius: 4px;
}
-.sortable td:last-child,
-.sortable th:last-child {
+.sortable thead td:last-child,
+.sortable thead th:last-child {
border-top-right-radius: 4px;
}
+.sortable td,
+.sortable th {
+ padding: 10px;
+}
body {
font-size: 14px;
diff --git a/dist/example.min.css b/dist/example.min.css
index 6fa91a9..cae9e50 100644
--- a/dist/example.min.css
+++ b/dist/example.min.css
@@ -1 +1 @@
-.sortable thead th:not(.no-sort){cursor:pointer}.sortable thead th:not(.no-sort)::after,.sortable thead th:not(.no-sort)::before{transition:color .1s ease-in-out;font-size:1.2em;color:rgba(0,0,0,0)}.sortable thead th:not(.no-sort)::after{margin-left:3px;content:"▸"}.sortable thead th:not(.no-sort):hover::after{color:inherit}.sortable thead th:not(.no-sort)[aria-sort=descending]::after{color:inherit;content:"▾"}.sortable thead th:not(.no-sort)[aria-sort=ascending]::after{color:inherit;content:"▴"}.sortable thead th:not(.no-sort).indicator-left::after{content:""}.sortable thead th:not(.no-sort).indicator-left::before{margin-right:3px;content:"▸"}.sortable thead th:not(.no-sort).indicator-left:hover::before{color:inherit}.sortable thead th:not(.no-sort).indicator-left[aria-sort=descending]::before{color:inherit;content:"▾"}.sortable thead th:not(.no-sort).indicator-left[aria-sort=ascending]::before{color:inherit;content:"▴"}.sortable{--stripe-bg: #e4e4e4;--stripe-color: #000;--stripe-bg-odd: #fff;--stripe-color-odd: #111;--th-bg: #808080;--th-color: #fff;border-spacing:0}.sortable.sticky thead th{position:sticky;top:0;z-index:1}.sortable tbody tr{background-color:var(--stripe-bg);color:var(--stripe-color)}.sortable tbody tr:nth-child(odd){background-color:var(--stripe-bg-odd);color:var(--stripe-color-odd)}.sortable thead th{background:var(--th-bg);color:var(--th-color);font-weight:normal;text-align:left;text-transform:capitalize;vertical-align:baseline;white-space:nowrap}.sortable td,.sortable th{padding:10px}.sortable td:first-child,.sortable th:first-child{border-top-left-radius:4px}.sortable td:last-child,.sortable th:last-child{border-top-right-radius:4px}body{font-size:14px}p{line-height:1.7em}code{font-family:monospace;background:#eee;padding:5px;border-radius:2px}*{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.sortable:nth-of-type(4) th:nth-child(7),thead th.no-sort{background:pink !important;color:red !important}.sortable:nth-of-type(4) th:nth-child(7){pointer-events:none}.sortable:nth-of-type(4) th:nth-child(7)::after{color:red;content:"(also not sortable)";font-size:.9em;display:block}.lefty td:nth-child(2),.lefty th:nth-child(2){text-align:right}@media(prefers-color-scheme: dark){body{background-color:#121212;color:#e0e0e0}code{background:#333;color:#e0e0e0}.sortable:nth-of-type(4) th:nth-child(7),thead th.no-sort{background:#444 !important;color:#ff6b6b !important}.sortable:nth-of-type(4) th:nth-child(7)::after{color:#ff6b6b}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}}
\ No newline at end of file
+.sortable thead th:not(.no-sort){cursor:pointer}.sortable thead th:not(.no-sort)::after,.sortable thead th:not(.no-sort)::before{transition:color .1s ease-in-out;font-size:1.2em;color:rgba(0,0,0,0)}.sortable thead th:not(.no-sort)::after{margin-left:3px;content:"▸"}.sortable thead th:not(.no-sort):hover::after{color:inherit}.sortable thead th:not(.no-sort)[aria-sort=descending]::after{color:inherit;content:"▾"}.sortable thead th:not(.no-sort)[aria-sort=ascending]::after{color:inherit;content:"▴"}.sortable thead th:not(.no-sort).indicator-left::after{content:""}.sortable thead th:not(.no-sort).indicator-left::before{margin-right:3px;content:"▸"}.sortable thead th:not(.no-sort).indicator-left:hover::before{color:inherit}.sortable thead th:not(.no-sort).indicator-left[aria-sort=descending]::before{color:inherit;content:"▾"}.sortable thead th:not(.no-sort).indicator-left[aria-sort=ascending]::before{color:inherit;content:"▴"}.sortable{--stripe-bg: #e4e4e4;--stripe-color: #000;--stripe-bg-odd: #fff;--stripe-color-odd: #111;--th-bg: #808080;--th-color: #fff;border-spacing:0}.sortable.sticky thead th{position:sticky;top:0;z-index:1}.sortable tbody tr{background-color:var(--stripe-bg);color:var(--stripe-color)}.sortable tbody tr:nth-child(odd){background-color:var(--stripe-bg-odd);color:var(--stripe-color-odd)}.sortable thead th{background:var(--th-bg);color:var(--th-color);font-weight:normal;text-align:left;text-transform:capitalize;vertical-align:baseline;white-space:nowrap}.sortable thead td:first-child,.sortable thead th:first-child{border-top-left-radius:4px}.sortable thead td:last-child,.sortable thead th:last-child{border-top-right-radius:4px}.sortable td,.sortable th{padding:10px}body{font-size:14px}p{line-height:1.7em}code{font-family:monospace;background:#eee;padding:5px;border-radius:2px}*{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.sortable:nth-of-type(4) th:nth-child(7),thead th.no-sort{background:pink !important;color:red !important}.sortable:nth-of-type(4) th:nth-child(7){pointer-events:none}.sortable:nth-of-type(4) th:nth-child(7)::after{color:red;content:"(also not sortable)";font-size:.9em;display:block}.lefty td:nth-child(2),.lefty th:nth-child(2){text-align:right}@media(prefers-color-scheme: dark){body{background-color:#121212;color:#e0e0e0}code{background:#333;color:#e0e0e0}.sortable:nth-of-type(4) th:nth-child(7),thead th.no-sort{background:#444 !important;color:#ff6b6b !important}.sortable:nth-of-type(4) th:nth-child(7)::after{color:#ff6b6b}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}}
\ No newline at end of file
diff --git a/dist/sortable.css b/dist/sortable.css
index b260eee..1622b66 100644
--- a/dist/sortable.css
+++ b/dist/sortable.css
@@ -72,15 +72,15 @@
vertical-align: baseline;
white-space: nowrap;
}
-.sortable td,
-.sortable th {
- padding: 10px;
-}
-.sortable td:first-child,
-.sortable th:first-child {
+.sortable thead td:first-child,
+.sortable thead th:first-child {
border-top-left-radius: 4px;
}
-.sortable td:last-child,
-.sortable th:last-child {
+.sortable thead td:last-child,
+.sortable thead th:last-child {
border-top-right-radius: 4px;
+}
+.sortable td,
+.sortable th {
+ padding: 10px;
}
\ No newline at end of file
diff --git a/dist/sortable.min.css b/dist/sortable.min.css
index 08e14fe..36c5b08 100644
--- a/dist/sortable.min.css
+++ b/dist/sortable.min.css
@@ -1 +1 @@
-.sortable thead th:not(.no-sort){cursor:pointer}.sortable thead th:not(.no-sort)::after,.sortable thead th:not(.no-sort)::before{transition:color .1s ease-in-out;font-size:1.2em;color:rgba(0,0,0,0)}.sortable thead th:not(.no-sort)::after{margin-left:3px;content:"▸"}.sortable thead th:not(.no-sort):hover::after{color:inherit}.sortable thead th:not(.no-sort)[aria-sort=descending]::after{color:inherit;content:"▾"}.sortable thead th:not(.no-sort)[aria-sort=ascending]::after{color:inherit;content:"▴"}.sortable thead th:not(.no-sort).indicator-left::after{content:""}.sortable thead th:not(.no-sort).indicator-left::before{margin-right:3px;content:"▸"}.sortable thead th:not(.no-sort).indicator-left:hover::before{color:inherit}.sortable thead th:not(.no-sort).indicator-left[aria-sort=descending]::before{color:inherit;content:"▾"}.sortable thead th:not(.no-sort).indicator-left[aria-sort=ascending]::before{color:inherit;content:"▴"}.sortable{--stripe-bg: #e4e4e4;--stripe-color: #000;--stripe-bg-odd: #fff;--stripe-color-odd: #111;--th-bg: #808080;--th-color: #fff;border-spacing:0}.sortable.sticky thead th{position:sticky;top:0;z-index:1}.sortable tbody tr{background-color:var(--stripe-bg);color:var(--stripe-color)}.sortable tbody tr:nth-child(odd){background-color:var(--stripe-bg-odd);color:var(--stripe-color-odd)}.sortable thead th{background:var(--th-bg);color:var(--th-color);font-weight:normal;text-align:left;text-transform:capitalize;vertical-align:baseline;white-space:nowrap}.sortable td,.sortable th{padding:10px}.sortable td:first-child,.sortable th:first-child{border-top-left-radius:4px}.sortable td:last-child,.sortable th:last-child{border-top-right-radius:4px}
\ No newline at end of file
+.sortable thead th:not(.no-sort){cursor:pointer}.sortable thead th:not(.no-sort)::after,.sortable thead th:not(.no-sort)::before{transition:color .1s ease-in-out;font-size:1.2em;color:rgba(0,0,0,0)}.sortable thead th:not(.no-sort)::after{margin-left:3px;content:"▸"}.sortable thead th:not(.no-sort):hover::after{color:inherit}.sortable thead th:not(.no-sort)[aria-sort=descending]::after{color:inherit;content:"▾"}.sortable thead th:not(.no-sort)[aria-sort=ascending]::after{color:inherit;content:"▴"}.sortable thead th:not(.no-sort).indicator-left::after{content:""}.sortable thead th:not(.no-sort).indicator-left::before{margin-right:3px;content:"▸"}.sortable thead th:not(.no-sort).indicator-left:hover::before{color:inherit}.sortable thead th:not(.no-sort).indicator-left[aria-sort=descending]::before{color:inherit;content:"▾"}.sortable thead th:not(.no-sort).indicator-left[aria-sort=ascending]::before{color:inherit;content:"▴"}.sortable{--stripe-bg: #e4e4e4;--stripe-color: #000;--stripe-bg-odd: #fff;--stripe-color-odd: #111;--th-bg: #808080;--th-color: #fff;border-spacing:0}.sortable.sticky thead th{position:sticky;top:0;z-index:1}.sortable tbody tr{background-color:var(--stripe-bg);color:var(--stripe-color)}.sortable tbody tr:nth-child(odd){background-color:var(--stripe-bg-odd);color:var(--stripe-color-odd)}.sortable thead th{background:var(--th-bg);color:var(--th-color);font-weight:normal;text-align:left;text-transform:capitalize;vertical-align:baseline;white-space:nowrap}.sortable thead td:first-child,.sortable thead th:first-child{border-top-left-radius:4px}.sortable thead td:last-child,.sortable thead th:last-child{border-top-right-radius:4px}.sortable td,.sortable th{padding:10px}
\ No newline at end of file
diff --git a/dist/standalone.html b/dist/standalone.html
deleted file mode 100644
index 410b3d1..0000000
--- a/dist/standalone.html
+++ /dev/null
@@ -1,373 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/standalone.min.html b/dist/standalone.min.html
deleted file mode 100644
index 039e0fc..0000000
--- a/dist/standalone.min.html
+++ /dev/null
@@ -1,373 +0,0 @@
-
-
-
-
-
-
- sortable test
-
-
-
-
- Sortable examples
-
- Basic sort
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Tiebreaker
- Sort by year
-
- (Appearance manually changed using style attributes. Just for demonstration.)
-
-
-style="
- --stripe-bg: #ff0;
- --stripe-color: #000;
- --stripe-bg-odd: #f0f;
- --stripe-color-odd: #111;
- --th-bg: blue;
- --th-color: #fff;"
-
-
-
- Month
- Year
- Day
- Time
-
-
-
-
- 11
- 2010
- 25
- 12:00
-
-
- 11
- 2010
- 25
- 15:00
-
-
- 04
- 2010
- 12
- 13:00
-
-
-
-
- If year is the same, sort by month.
- If month is the same, sort by day.
- If day is the same, sort by time
-
-
- Colspans
-
-
-
-
- nums + chars
- CHARS
-
-
-
-
- 333
- 222
- BB
-
-
- 1
- 111
- CCC
-
-
- 22
- 333
- A
-
-
-
-
- Empty/null sorted last
-
-
-
-
- Text
- Number
-
-
-
-
- jkl
- 0.4
-
-
- abc
- 0
-
-
- should be sorted last
- (if click in this column)
-
-
- def
- 0.2
-
-
-
-
- class="no-sort"
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- numeric sorting
-
-
-
- Role
- Time
- Amount
- Number
-
-
-
-
- Genius
- 12:00:12
- $18.49
- 2.49
-
-
- Sidekick
- 12:22:11
- $2.49
- 18.49
-
-
- Butler
- 12:22:05
- $1.96
- 1.96
-
-
-
-
- Ascending sort
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- Alternative sort
-
-
-
-
- Movie Name
- Size
-
-
-
-
- A
- B
-
-
- D
- E
-
-
- J
- K
-
-
-
-
- TR element with no TD element (invalid HTML)
-
-
-
-
- Letters
-
-
-
-
- CCC
-
-
-
-
- DDD
-
-
- AAA
-
-
-
-
- TD with "incorrect" whitespace
-
-
-
-
- Role
- Name
-
-
-
-
- Genius
- Rick
-
-
- Sidekick
- Morty
-
-
-
-
- HTML Tag Support
-
-
-
-
- Event
- Date
- Progress
- Score
- Abbreviation
-
-
-
-
- Meeting
- March 15, 2024
- 75%
- 8.5/10
- WWW
-
-
- Conference
- January 10, 2024
- 50%
- 9.2/10
- API
-
-
- Workshop
- December 1, 2024
- 90%
- 7.8/10
- HTML
-
-
- Seminar
- June 20, 2024
- Unknown
- Six point five
- CSS
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/example.css b/docs/example.css
index 6b8861c..aeabdac 100644
--- a/docs/example.css
+++ b/docs/example.css
@@ -72,18 +72,18 @@
vertical-align: baseline;
white-space: nowrap;
}
-.sortable td,
-.sortable th {
- padding: 10px;
-}
-.sortable td:first-child,
-.sortable th:first-child {
+.sortable thead td:first-child,
+.sortable thead th:first-child {
border-top-left-radius: 4px;
}
-.sortable td:last-child,
-.sortable th:last-child {
+.sortable thead td:last-child,
+.sortable thead th:last-child {
border-top-right-radius: 4px;
}
+.sortable td,
+.sortable th {
+ padding: 10px;
+}
body {
font-size: 14px;
diff --git a/docs/index.html b/docs/index.html
index 5c0aa76..1bd5005 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -6,6 +6,7 @@
sortable test
+
@@ -344,6 +345,7 @@ HTML Tag Support
setTimeout(() => {
const table = document.createElement('table')
table.classList.add('sortable')
+ table.classList.add('searchable')
table.innerHTML = `
@@ -358,13 +360,15 @@ HTML Tag Support
`
const div = document.createElement('div')
div.innerHTML = `MutationObserver Test
- This table was added using setTimeout. It will be sorted by default when using the sortable.auto.js package.
`
+ This table was added using setTimeout. It will be sorted by default when using the sortable.auto.js package.
+ Just for fun we made it searchable also.
`
document.body.insertBefore(div, document.body.firstChild)
// If I append the the table to the div before appending it to the body,
// the MutationObserver will not trigger, since we are adding a div, not a table..
div.appendChild(table)
}, 2000) // Long delay so you can see the table being added
+
diff --git a/index.html b/index.html
index cb376aa..ac13fa1 100644
--- a/index.html
+++ b/index.html
@@ -6,6 +6,7 @@
sortable test
+
Sortable examples
@@ -343,6 +344,7 @@ HTML Tag Support
setTimeout(() => {
const table = document.createElement('table')
table.classList.add('sortable')
+ table.classList.add('searchable')
table.innerHTML = `
@@ -357,13 +359,15 @@ HTML Tag Support
`
const div = document.createElement('div')
div.innerHTML = `MutationObserver Test
- This table was added using setTimeout. It will be sorted by default when using the sortable.auto.js package.
`
+ This table was added using setTimeout. It will be sorted by default when using the sortable.auto.js package.
+ Just for fun we made it searchable also.
`
document.body.insertBefore(div, document.body.firstChild)
// If I append the the table to the div before appending it to the body,
// the MutationObserver will not trigger, since we are adding a div, not a table..
div.appendChild(table)
}, 2000) // Long delay so you can see the table being added
+