|
| 1 | +## Sortable |
| 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. |
| 4 | + |
| 5 | +#### Demo |
| 6 | + |
| 7 | +<p style="display: none"></p> |
| 8 | +<table data-sortable> <thead> <tr> <th data-sortable="false">Browser</th> <th data-sorted="true" data-sorted-direction="descending">Usage</th> <th>Initial release</th> <th>Stable version</th> </tr> </thead> <tbody> <tr> <td>Chrome</td> <td>42.68%</td> <td data-value="2008">September 2, 2008</td> <td>31.0.1650.57</td> </tr> <tr> <td>Internet Explorer</td> <td>25.44%</td> <td data-value="1995">August 16, 1995</td> <td>11.0.1</td> </tr> <tr> <td>Firefox</td> <td>20.01%</td> <td data-value="2002">September 23, 2002</td> <td>25.0.1</td> </tr> <tr> <td>Safari</td> <td>8.39%</td> <td data-value="2003">January 7, 2003</td> <td>7.0</td> </tr> <tr> <td>Opera</td> <td>1.03%</td> <td data-value="1994">Late 1994</td> <td>18.0.1284.49</td> </tr> <tr> <td>Other</td> <td data-value="0">2.44%</td> <td data-value="-1"></td> <td></td> </tr> </tbody> </table> |
| 9 | +<p style="display: none"></p> |
| 10 | + |
| 11 | +#### Features |
| 12 | + |
| 13 | +- Drop-in script and styles |
| 14 | +- 6 beautiful CSS themes |
| 15 | +- Tiny footprint (<code><2kb</code>) and no dependencies |
| 16 | +- Looks and behaves great on mobile devices |
| 17 | + |
| 18 | +#### Requirements |
| 19 | + |
| 20 | +- None |
| 21 | + |
| 22 | +#### Browser Support |
| 23 | + |
| 24 | +- IE10+ |
| 25 | +- Firefox 4+ |
| 26 | +- Current WebKit (Chrome, Safari) |
| 27 | +- Opera |
| 28 | + |
| 29 | +#### Including |
| 30 | + |
| 31 | +For the most common usage of sortable, you'll want to include following: |
| 32 | + |
| 33 | +```html |
| 34 | +<script src="sortable.min.js"></script> |
| 35 | +<link rel="stylesheet" href="sortable-theme-light.css" /> |
| 36 | +<script>setTimeout(function(){ sortable.init(); }, 0);</script> |
| 37 | +``` |
| 38 | + |
| 39 | +Now any table with the attribute `data-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 | + |
| 41 | +```html |
| 42 | +<table class="sortable-theme-light" data-sortable> |
| 43 | + <!-- ... --> |
| 44 | +</table> |
| 45 | +``` |
| 46 | + |
| 47 | +This example uses the "light" theme. For a full list of supported themes, check out [Themes](/sortable/api/themes). |
| 48 | + |
| 49 | +#### Learn More |
| 50 | + |
| 51 | +To learn more about how to use sortable, visit our API pages. |
| 52 | + |
| 53 | +- [Basic](http://github.hubspot.com/vex/api/basic) |
| 54 | +- [Themes](http://github.hubspot.com/vex/api/themes) |
| 55 | + |
| 56 | +#### Credits |
| 57 | + |
| 58 | +Sortable is free and open-source, released on the [MIT Licenese](https://github.com/HubSpot/sortable/blob/master/LICENSE). |
| 59 | + |
| 60 | +#### Credits |
| 61 | + |
| 62 | +Sortable was built by [Adam Schwartz](http://twitter.com/adamfschwartz) |
| 63 | + |
| 64 | +<!-- Resources for the demos --> |
| 65 | +<p style="-webkit-transform: translateZ(0)"></p> |
| 66 | +<script src="/sortable/js/sortable.js"></script> |
| 67 | +<link rel="stylesheet" href="/sortable/css/sortable-theme-light.css" /> |
| 68 | +<script>setTimeout(function(){ sortable.init(); }, 0);</script> |
0 commit comments