Skip to content

Commit 003e1fd

Browse files
Update the npm package to 1.5.8.
1 parent 271b5a4 commit 003e1fd

File tree

3 files changed

+429
-207
lines changed

3 files changed

+429
-207
lines changed

npm/README.md

Lines changed: 41 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,52 @@
1-
![table-sort-js](https://img.shields.io/npm/v/table-sort-js) : https://www.npmjs.com/package/table-sort-js
1+
![table-sort-js](https://img.shields.io/npm/v/table-sort-js)
2+
![table-sort-js](https://img.shields.io/npm/dm/table-sort-js)
3+
![table-sort-js](https://img.shields.io/github/repo-size/leewannacott/table-sort-js)
4+
![table-sort-js](https://img.shields.io/github/license/LeeWannacott/table-sort-js)
5+
![table-sort-js](https://img.shields.io/github/workflow/status/leewannacott/table-sort-js/Jest%20CI%20-%20Automated%20testing%20of%20table%20sorting.?label=tests)
26

3-
* Description: A JavaScript client-side HTML table sorting library with no dependencies required.
7+
## TABLE-SORT-JS.
48

5-
* Demo: https://leewannacott.github.io/Portfolio/#/GitHub
9+
- Description: A JavaScript client-side HTML table sorting library with no dependencies required.
610

7-
* Backend: `npm install table-sort-js` and require("../node_modules/table-sort-js/table-sort.js")
11+
- [Demo](https://leewannacott.github.io/Portfolio/#/GitHub)
12+
- [Documentation.](https://leewannacott.github.io/table-sort-js/docs/about.html)
13+
(work in progress)
14+
- [npm package.](https://www.npmjs.com/package/table-sort-js)
15+
## Install instructions.
816

9-
* Frontend: `<script src="https://leewannacott.github.io/table-sort-js/table-sort.js"></script>`
17+
<b>Option 1.</b> Install from npm: ` npm install table-sort-js`
1018

11-
* Instructions: Add class "table-sort" to HTML table tags. Click on column headers to sort.
19+
```javascript
20+
import tableSort from "table-sort-js/table-sort.js";
21+
```
22+
Refer to the documentation for examples on using table-sort-js with frontend frameworks such as
23+
[ReactJS.](https://leewannacott.github.io/table-sort-js/docs/react.html)
1224

13-
Example:
14-
```html
15-
<script src="https://leewannacott.github.io/table-sort-js/table-sort.js"></script>
16-
<table class="table-sort">
17-
<thead>
18-
<tr>
19-
<th>Last Name</th>
20-
<th>First Name</th>
21-
<th class="order-by-desc">Birth Date</th>
22-
<th>Employee ID</th>
23-
</tr>
24-
</thead>
25-
<tbody>
26-
<tr>
27-
<td>Smith</td>
28-
<td>John</td>
29-
<td>1977/12/4</td>
30-
<td>1</td>
31-
</tr>
32-
<tr>
33-
<td>Bach</td>
34-
<td>Frank</td>
35-
<td>1976/10/27</td>
36-
<td>10</td>
37-
</tr>
38-
<tr>
39-
<td>Doe</td>
40-
<td>Jason</td>
41-
<td>1978/4/6</td>
42-
<td>100</td>
43-
</tr>
44-
<tr>
45-
<td>Michael</td>
46-
<td>Jackson</td>
47-
<td>1958/8/29</td>
48-
<td>54</td>
49-
</tr>
25+
<b>Option 2.</b> [Download table-sort.js](https://leewannacott.github.io/table-sort-js/table-sort.js) (Select save as.)
5026

51-
<tr>
52-
<td>Ben</td>
53-
<td>Tenison</td>
54-
<td>1994/7/21</td>
55-
<td>134</td>
56-
</tr>
57-
</tbody>
58-
</table>
27+
Then add the following script before your HTML table:
28+
```html
29+
<script src="table-sort.js"></script>
5930
```
60-
Notes:
61-
* Makes use of natural sorting to sort numerical values correctly. Sorts numbers, Dates, alphanumeric, etc.
31+
Refer to the documenation for examples how to use table-sort-js with [HTML.](https://leewannacott.github.io/table-sort-js/docs/html5.html)
32+
#### To make tables sortable:
33+
34+
- Add `class="table-sort"` to HTML &lt;table&gt; tags.
35+
- Click on table headers to sort columns.
36+
37+
#### Classes:
6238

63-
* `class="order-by-desc"` on `<th>` to change default sort to descending order on first click.
64-
65-
* If `<thead>` does not exist it will be created by using data from first row. `<tbody>` is optional.
39+
| &lt;table&gt; classes | Description |
40+
| -------------- | ------------------------------------------------ |
41+
| "table-sort" | Make the table sortable! (Words, numbers, dates) |
42+
| "table-arrows" | Display ascending or descending triangles. |
43+
| "remember-sort"| If clicking on different columns remembers sort of the original column. |
6644

67-
* Example of use: https://www.cssscript.com/minimal-table-sorter/
45+
| &lt;th&gt; classes | Description |
46+
| --------------- | ----------------------------------------------------------- |
47+
| "order-by-desc" | Order by descending on first click. (default is aescending) |
48+
| "file-size" | Sort file sizes(B->TiB) uses the binary prefix. (e.g KiB) |
49+
| "data-sort" | Sort by [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes), e.g &lt;td data-sort="42"&gt; |
6850

69-
* Add `table-arrows` class to display ascending or descending triangle.
51+
#### Development:
52+
If you wish to contribute, install instructions can be found [here.](https://leewannacott.github.io/table-sort-js/docs/development.html)

npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "table-sort-js",
3-
"version": "1.1.6c",
3+
"version": "1.5.8",
44
"description": "A JavaScript client-side HTML table sorting library with no dependencies required.",
55
"license": "MIT",
66
"repository": "LeeWannacott/table-sort-js",

0 commit comments

Comments
 (0)