st-multi-sort
v1.1.2
Published
Multi column sorting directive for smart table
Downloads
330
Readme
Smart Table Multi Sort
A multi-column sorting directive for Smart Table. It works just like stSort, but also supports:
- stable sort - clicking another column preserves the previous sort order when possible
- shift click sorting - shift or ctrl clicking a column adds that column as a secondary sort
Usage
Simply use st-multi-sort instead of st-sort.
<table class='table' st-table='displayPunchcards' st-safe-src='punchcards'>
<thead>
<tr>
<th st-multi-sort='name'>Name</th>
<th st-multi-sort='age'>Age</th>
</tr>
</thead>
<tbody>
...
</tbody>
</table>
Note, if you want to support shift clicking, I recommend you add this CSS to prevent the text from highlighting on click:
[st-multi-sort] {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
}
Contributing
Please follow our Code of Conduct when contributing to this project.
$ git clone https://github.com/goodeggs/st-multi-sort && cd st-multi-sort
$ npm install
$ npm test
Module scaffold generated by generator-goodeggs-npm.