You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sortable is an open-source javascript and CSS library which adds sorting functionality to tables. It is tiny (`<2kb`) and has no dependencies.
6
-
7
-
#### Credits
8
-
9
-
Loosely based on [Stuart Langridge](https://github.com/stuartlangridge)'s [SortTable](http://www.kryogenix.org/code/browser/sorttable/) ([History](https://github.com/HubSpot/sortable/commits/e068642453bb39eed676ed338e9bbeb372ca74c4/sorttable.js), [Original](https://github.com/HubSpot/sortable/blob/37894eb51bda9f0e438d735967f16eef0d403ef9/sorttable.js))
5
+
Sortable is an open-source JavaScript and CSS library which adds sorting functionality to tables. It is tiny (`<2kb` min+gzip) and has no dependencies.
Copy file name to clipboardExpand all lines: docs/api/1-Options.md
+63-1Lines changed: 63 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Example:
16
16
17
17
All tables on the page will be automatically initted when the page is loaded.
18
18
19
-
If you add tables with javascript, call `init` after they are added to the page:
19
+
If you add tables with JavaScript, call `init` after they are added to the page:
20
20
21
21
```coffeescript
22
22
Sortable.init()
@@ -68,6 +68,68 @@ To disable sorting on a particular column, add `data-sortable="false"` to the `<
68
68
</table>
69
69
```
70
70
71
+
##### `th``data-sortable-type="TYPE_NAME"`
72
+
73
+
By default, the `type` of data in each column is determined by reading the first cell of a column and trying to `match` it to the list of types. To specify a type directly, use `data-sortable-type`.
74
+
75
+
The default types supplied by Sortable are `alpha`, `numeric`, and `date`.
The default types supplied by Sortable are `alpha`, `numeric`, and `date`. To supply you own, call `Sortable.setupTypes(customTypesArray)` and pass in your custom types array.
100
+
101
+
Here’s how Sortable internally sets up the defaults.
Copy file name to clipboardExpand all lines: docs/intro.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
## Sortable
2
2
3
-
Sortable is an open-source javascript and CSS library which adds sorting functionality to tables. It is tiny (<code><2kb</code>) and has no dependencies.
3
+
Sortable is an open-source JavaScript and CSS library which adds sorting functionality to tables. It is tiny (<code><2kb</code> min+gzip) and has no dependencies.
Now any table with the attribute `sortable` will be made sortable. To get the styling, you'll also need to add a class name to the table to match the theme you chose:
40
+
Now any table with the attribute `sortable` will be made sortable. To get the styling, you’ll also need to add a class name to the table to match the theme you chose:
0 commit comments