Coder Social home page Coder Social logo

sorttable's Introduction

JavaScript client-side sortable tables

See http://www.kryogenix.org/code/browser/sorttable/ for details and FAQ.

Running the tests:
grunt test

Requires various things, including phantomjs, to be around. To get phantomjs, `sudo apt-get install phantomjs`; to get the test dependencies, `npm install`.

To add new tests, edit tests/test-definitions.json and add a new item to the top-level "tests" var. For example,

        "basic": {
            "rows": [
                ["1", "dog",    "Adam"],
                ["2", "apple",  "Charles"],
                ["3", "banana", "Bill"],
                ["4", "cat",    "David"]
            ],
            "expected_column_1_after_sort_by_column_n": [
                ["1", "2", "3", "4"],
                ["2", "3", "4", "1"],
                ["1", "3", "2", "4"]
            ]
        }

This defines (in "rows") a table with four rows and three columns. In "expected_column_1_after_sort_by_column_n" is then defined one tuple for each column; a tuple shows the contents of column 1, in order.

So, the above example has three tuples in it, one for each column. The second tuple, ["2", "3", "4", "1"], is saying that after sorting the table by the second column, we should see the *first* column containing the values "2", "3", "4", and "1", in that order.

It is advisable to make the first column of all test tables be the integers, because it makes things easier to understand, but it's not compulsory.

sorttable's People

Contributors

stuartlangridge avatar

Watchers

 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.