|
3 | 3 | <head> |
4 | 4 | <meta charset="UTF-8" /> |
5 | 5 | <title>table-sort-js : documentation</title> |
6 | | - <link rel="stylesheet" href="index.css" /> |
7 | 6 | <script src="https://kit.fontawesome.com/b99e675b6e.js"></script> |
| 7 | + <link rel="stylesheet" href="index.css" /> |
8 | 8 | <script src="../table-sort.js"></script> |
| 9 | + <link href="assets/solarized-dark.css" rel="stylesheet" type="text/css" /> |
9 | 10 | </head> |
10 | 11 | <body> |
| 12 | + <script src="./assets/rainbow.js"></script> |
11 | 13 | <div class="wrapper"> |
12 | 14 | <div class="sidebar"> |
13 | 15 | <h2>table-sort-js</h2> |
@@ -63,48 +65,145 @@ <h2>table-sort-js</h2> |
63 | 65 | <div class="main_content"> |
64 | 66 | <div class="header">Classes that can be used with table-sort-js.</div> |
65 | 67 | <div class="info"> |
66 | | - <table class="table table-sort" id="classes-table" style="width: 100%"> |
| 68 | + <table |
| 69 | + class="table table-sort" |
| 70 | + id="classes-table" |
| 71 | + style="width: 100%" |
| 72 | + > |
67 | 73 | <thead> |
68 | | - <tr> |
69 | | - <th><table class=""></th> |
70 | | - <th>Description</th> |
71 | | - </tr> |
| 74 | + <tr> |
| 75 | + <th><table class=""></th> |
| 76 | + <th>Description</th> |
| 77 | + </tr> |
72 | 78 | </thead> |
73 | 79 | <tr> |
74 | 80 | <td>table-sort</td> |
75 | | - <td>Make tables sortable!. Sorts: Words, Numbers(naturally) and Dates |
76 | | - out of the box without any config.</td> |
| 81 | + <td> |
| 82 | + Make tables sortable!. Sorts: Words, Numbers(naturally) and |
| 83 | + Dates out of the box without any config. |
| 84 | + </td> |
77 | 85 | </tr> |
78 | 86 | <tr> |
79 | 87 | <td>table-arrows</td> |
80 | | - <td>Adds up or down arrows to indicate whether column is sorted in aescending |
81 | | - or descending order.</td> |
| 88 | + <td> |
| 89 | + Adds up or down arrows to indicate whether column is sorted in |
| 90 | + aescending or descending order. |
| 91 | + </td> |
82 | 92 | </tr> |
83 | 93 | </table> |
84 | | - <br> |
85 | | - <table class="table table-sort" id="classes-table" style="width: 100%"> |
| 94 | + <br /> |
| 95 | + <table |
| 96 | + class="table table-sort" |
| 97 | + id="classes-table" |
| 98 | + style="width: 100%" |
| 99 | + > |
86 | 100 | <thead> |
87 | | - <tr> |
88 | | - <th><th class=""></th> |
89 | | - <th>Description</th> |
90 | | - </tr> |
| 101 | + <tr> |
| 102 | + <th><th class=""></th> |
| 103 | + <th>Description</th> |
| 104 | + </tr> |
91 | 105 | </thead> |
92 | 106 | <tr> |
93 | 107 | <td>order-by-desc</td> |
94 | | - <td>Orders by descending on the first click of a column (default |
95 | | - aescending). Naming inspired by |
96 | | - SQL.</td> |
| 108 | + <td> |
| 109 | + Orders by descending on the first click of a column (default |
| 110 | + aescending). Naming inspired by SQL. |
| 111 | + </td> |
97 | 112 | </tr> |
98 | 113 | <tr> |
99 | 114 | <td>file-size</td> |
100 | | - <td>Supports sorting files sizes from bytes to Tebibytes (B -> TiB). Can be Metric prefix (e.g 10KB), or Binary |
101 | | - prefix(e.g 25KiB) and can contain a space or no space |
102 | | - between number and unit type (e.g 25KB or 25 KB). It converts |
103 | | - units into numbers (bytes) does |
104 | | - conversion and then outputs to the binary prefix rounded to two |
105 | | - decimal places. (e.g 25.00 KiB).</td> |
| 115 | + <td> |
| 116 | + Supports sorting files sizes from bytes to Tebibytes (B -> TiB). |
| 117 | + Can be Metric prefix (e.g 10KB), or Binary prefix(e.g 25KiB) and |
| 118 | + can contain a space or no space between number and unit type |
| 119 | + (e.g 25KB or 25 KB). It converts units into numbers (bytes) does |
| 120 | + conversion and then outputs to the binary prefix rounded to two |
| 121 | + decimal places. (e.g 25.00 KiB). |
| 122 | + </td> |
| 123 | + </tr> |
| 124 | + <tr> |
| 125 | + <td>data-sort</td> |
| 126 | + <td> |
| 127 | + Sort by data <a |
| 128 | + href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes" |
| 129 | + target="blank">attributes<a/>, e.g <td |
| 130 | + data-sort="42"></td> useful when you want to sort |
| 131 | + by the values inside of data-sort="" rather than values between |
| 132 | + td tags. For example:<br/><br/> |
| 133 | + <li><td data-sort="1">table</td></li> |
| 134 | + <li><td data-sort="2">sort</td> </li> |
| 135 | + <li><td data-sort="3">js</td> </li> |
| 136 | + <br/> |
| 137 | + Will end up sorting in the order 1, 2 ,3 which spells out: |
| 138 | + <mark><i>table sort |
| 139 | + js</i></mark>. As opposed to sorting what is inside the |
| 140 | + <td> tags alphabetically which would spell: <mark |
| 141 | + ><i>js sort |
| 142 | + table</i></mark>. This is useful for making custom sorts |
| 143 | + not supported by table-sort-js. |
| 144 | + </td> |
106 | 145 | </tr> |
107 | 146 | </table> |
| 147 | + <br> |
| 148 | + <h3>Example using tags:</h3> |
| 149 | + |
| 150 | + <pre> |
| 151 | + <code style="font-size:1.3em" data-language="html"> |
| 152 | +<script src="table-sort.js"></script> |
| 153 | +<table class="table-sort table-arrows"> |
| 154 | + <thead> |
| 155 | + <tr> |
| 156 | + <th class="data-sort">data</th> |
| 157 | + <th class="file-size">file sizes</th> |
| 158 | + <th class="order-by-desc">birth date</th> |
| 159 | + </tr> |
| 160 | + </thead> |
| 161 | + <tbody> |
| 162 | + <tr> |
| 163 | + <td data-sort="2">sort</td> |
| 164 | + <td>10KiB</td> |
| 165 | + <td>1706/1/17</td> |
| 166 | + </tr> |
| 167 | + <tr> |
| 168 | + <td data-sort="3">js</td> |
| 169 | + <td>1MB</td> |
| 170 | + <td>1835/11/25</td> |
| 171 | + </tr> |
| 172 | + <tr> |
| 173 | + <td data-sort="1">table</td> |
| 174 | + <td>1TB</td> |
| 175 | + <td>1835/11/30</td> |
| 176 | + </tr> |
| 177 | + </tbody> |
| 178 | +</table> |
| 179 | + </code> |
| 180 | + </pre> |
| 181 | +<table class="table-sort table-arrows" id="classes-table"> |
| 182 | + <thead> |
| 183 | + <tr> |
| 184 | + <th class="data-sort">data</th> |
| 185 | + <th class="file-size">file sizes</th> |
| 186 | + <th class="order-by-desc">birth date</th> |
| 187 | + </tr> |
| 188 | + </thead> |
| 189 | + <tbody> |
| 190 | + <tr> |
| 191 | + <td data-sort="2">sort</td> |
| 192 | + <td>10KiB</td> |
| 193 | + <td>1706/1/17</td> |
| 194 | + </tr> |
| 195 | + <tr> |
| 196 | + <td data-sort="3">js</td> |
| 197 | + <td>1 MB</td> |
| 198 | + <td>1835/11/25</td> |
| 199 | + </tr> |
| 200 | + <tr> |
| 201 | + <td data-sort="1">table</td> |
| 202 | + <td>1TB</td> |
| 203 | + <td>1835/11/30</td> |
| 204 | + </tr> |
| 205 | + </tbody> |
| 206 | +</table> |
108 | 207 | </div> |
109 | 208 | </div> |
110 | 209 | </div> |
|
0 commit comments