Sorting by size or by case
sortAbsolute sorts numbers by their size whatever the sign, and sortCaseSensitive sorts upper and lower case and accents apart.
createGrid(el, {
columns: [
{ field: 'change', type: 'number', sortAbsolute: true }, // 2, -5, 10, -50 (by size)
{ field: 'code' },
],
data,
sortCaseSensitive: true, // a, B, b
});| Option | Without | With |
|---|---|---|
| sortAbsolute (column) | -50, -5, 2, 10 | 2, -5, 10, -50 |
| sortCaseSensitive (grid) | a, b, B (or b, B: case ignored) | a, B, b |
sortCaseSensitiveputs capitals first when two values differ only in case, and also sorts accented letters apart (é after e). It affects grouping order and set-filter lists too.- Numbers inside text still sort as numbers (item 2 before item 10).
- For anything else, give the column a
comparator(a, b, rowA, rowB).