Yats.js is a simple javascript table sorter.
You can use it if you want, but mostly this table sorter was an exercise for me to do some vanilla js MVC style.
To use yats.js include yats.js
at the bottom of your page. Furthermore you will need to include the yats.css
file and the font-awesome.
There are two ways to target your tables:
- Add a
data-tablesort
attribute to the tables you want to enable sorting on. - Call
sortTable(".your-selector");
At the moment yats.js has some limitations. It expects your table have a layout like so:
<table>
<thead>
<tr>
<th>Headings</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content</td>
</tr>
...
</tbody>
</table>
Since yats.js
uses Font Awesome, you might want to get rid of that dependency. You can take a look at the yats.css
file, it is really small.
To play around, or develop it you can use:
bundle install
rake server
See license.txt