st-multi-sort

1.1.2 • Public • Published

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

build status npm version MIT license we're hiring

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.

Package Sidebar

Install

npm i st-multi-sort

Weekly Downloads

49

Version

1.1.2

License

MIT

Unpacked Size

107 kB

Total Files

14

Last publish

Collaborators

  • goodeggs-admin
  • dannynelson