GithubHelp home page GithubHelp logo

socarlosb / tablesort Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tristen/tablesort

0.0 1.0 0.0 349 KB

:arrow_up_down: A small tablesorter in plain JavaScript

Home Page: http://tristen.ca/tablesort/demo/

License: MIT License

JavaScript 97.01% HTML 2.64% CSS 0.35%

tablesort's Introduction

tablesort

A small & simple sorting component for tables written in JavaScript.

npm version Build Status

Quick start

Download the ZIP of this repository or install via command line:

npm install tablesort 
# Or if you're using Yarn 
yarn add tablesort 
<script src='tablesort.min.js'></script>

<!-- Include sort types you need -->
<script src='tablesort.number.js'></script>
<script src='tablesort.date.js'></script>

<script>
  new Tablesort(document.getElementById('table-id'));
</script>

See usage and demos for more


Browser Support

Chrome logo Firefox logo Internet Explorer logo Opera logo Safari logo
8+ ✔ 3.6+ ✔ 10+ ✔ 11.50+ ✔ 5.1+ ✔

Node/Browserify

// npm install tablesort
var tablesort = require('tablesort');

tablesort(el, options);

Default CSS

Add the styling from tablesort.css file to your CSS or roll with your own.

Extending Tablesort

If you require a sort operation that does not exist in the sorts directory, you can add your own.

Tablesort.extend('name', function(item) {

  // Regular expression to test against.
  // `item` is a table value to evaluate.
  return /foo/.test(item);
}, function(a, b) {

  // Custom sort functionality goes here.
  // e.g var n = (a > b) ? -1 : 1;
  return n;
});

If you've made an extend function that others would benifit from pull requests are gladly accepted!

Contributing

Tablesort relies on Grunt as its build tool. Simply run npm run build to package code from any contributions you make to src/tablesort.js before submitting pull requests.

Tests are run via:

npm install && npm test

Licence

MIT

Bugs?

Create an issue

tablesort's People

Contributors

tristen avatar xpaw avatar tripu avatar jonashaag avatar jhvst avatar rogerdodger avatar omp avatar kausters avatar andersos avatar asindhu avatar brianlmoon avatar colinodell avatar danieljb avatar davidjb avatar decklin avatar dongliu avatar lunardevelopment avatar matstc avatar sabas avatar webgefrickel avatar timbowhite avatar tonglil avatar ariarijp avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.