I think tablesort should work fine here and it almost seems like it does, but not quite. Trying to sort alphabetically here admin/people?sort=asc&order=Username I get:
jajosene active 2 days 3 hours 1 day 9 hours ago edit
jacophenoro active 4 days 17 hours 1 day 9 hours ago edit
engelund active 1 day 6 hours 1 day 2 hours ago edit
frunab active 5 days 3 hours 1 day 9 hours ago edit
gabastacle active 6 days 10 hours 1 day 9 hours ago edit
guwuchun active 6 days 5 hours 1 day 9 hours ago edit
bawracligip ...
Ordering by time admin/people?sort=asc&order=Member for i get:
stihunistu active 2 days 23 hours 1 day 9 hours ago edit
nethemek active 3 days 4 hours 1 day 9 hours ago edit
lushebi active 2 days 22 hours 1 day 9 hours ago edit
loswat active 2 days 21 hours 1 day 9 hours ago edit
swatrathi active 2 days 20 hours 1 day 9 hours ago edit
kaloclubuj active 3 days 8 hours 1 day 9 hours ago edit
wrebrobu ...
I'm not sure where this is going wrong as it does at least change between asc & desc but doesn't seem to be accurate.
Comments
Comment #1
rayasa commentedSurprised to see no response for so long for such an annoying bug.
The sort functionality is broken for all tableselects such as content table, comment table, user table etc.
The problem lies in the following function
Here, although the comment says that the options will be sorted if they have a #weight property , but no check has been placed. So, the uasort result for unweighted options is undefined as the function element_sort compares options based on property '#weight'.
Also, for the user, node or comment table the sort results are directly obtained from the DB, and need not be re-sorted here.
The patch attached puts a check based on the assumption that all options are either weighted or all unweighted. The patch can be bettered on review.
Comment #2
heine commentedDuplicate of #700380: Regression: Tableselect sorting is altered if '#weight' is not set