There are a couple problems with column sorting:
- Even / odd row classes. In default sort when a page first loads, all rows are properly shaded odd / even. But if you re-sort (click arrow), then becomes incorrect. The even / odd assignment does not appear to change when the sort order changes.
- Sort order. Columns with numbers do not sort in correct order in the normal page mode, but do sort correctly in edit mode. For instance in page view mode, a list of 1-30, items go: 1, 10, 11, 12,..., 2, 20, 21, 22, ..., 3, 30, 31, etc. This same table when viewed from the edit tab behaves properly. Screenshots attached.
There may also be an issue with sorting when a mix of numeric and alpha entries are present in a single column, but let's address these above firstly.
| Comment | File | Size | Author |
|---|---|---|---|
| NT-columsort-viewtab.jpg | 13.81 KB | john.kenney | |
| NT-columsort-edittab.jpg | 20.49 KB | john.kenney |
Comments
Comment #1
zserno commentedDid some research on the mix sorting problem. Turned out that tablesorter (the 3rd party jQuery plugin that is used for dynamic sorting) is not able to handle columns with mixed data. One possible solution is to use a so called natural sorting algorithm for such columns.
This one looks good: http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm-with...
Comment #2
Patricia_W commentedI was able to sort on some numbers ... in particular $ amounts. But I could not sort on other numbers. I changed a couple of the columns to have decimal positions and it appears that the sort works correctly when there are 2 decimal positions and not when only one. I say "appears" because I have not done extensive testing.
Is there a way to change the alignment of the cells for numbers and money?