-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
README
33 lines (23 loc) · 1.38 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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.