Skip to content

JavaScript client-side sortable tables

Notifications You must be signed in to change notification settings

monkey-ldb/sorttable

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript client-side sortable tables

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

If you just want sorttable.js itself, it's in the `sorttable/` folder.

Running the tests:
grunt test

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.

About

JavaScript client-side sortable tables

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.0%
  • HTML 1.0%