Opened 13 years ago

Closed 12 years ago

#2378 closed defect (wontfix)

FilteringTable: sorts even when not requested to

Reported by: kayegypt@… Owned by: Tom Trenka
Priority: high Milestone:
Component: Widgets Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:


FilteringTable?.createSorter() returns a compare function even if there is no information on how to sort (sortFunctions array contains 0 elements). It then sorts the rows using this compare function, which returns always 0. Depending on the browser (its internal sorting algorithm) the rows are left alone (IE), or shuffled (Firefox). Per intuition I would suppose FilteringTable? to show the rows in natural order in this case. So I added 3 lines to FilteringTable?.createSorter() (above the final "return" statement):

if (sortFunctions.length == 0) {



The only caller within FilteringTable? is render(), which already does the right thing if createSorter() returns undefined.

Attachments (2)

wrongsort.patch (773 bytes) - added by kayegypt@… 13 years ago.
suggested patch to be applied to current head of FilteringTable?.js
wrongsort.2.patch (477 bytes) - added by guest 13 years ago.
corrected patch - I'm sorry, the first one was nonsense

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by kayegypt@…

Attachment: wrongsort.patch added

suggested patch to be applied to current head of FilteringTable?.js

Changed 13 years ago by guest

Attachment: wrongsort.2.patch added

corrected patch - I'm sorry, the first one was nonsense

comment:1 Changed 13 years ago by tdedischew@…

I'd like to also see a generic enableSort="true/false" option that's examined inside render(), and when false, skips sorting altogether...

This would avoid having to do noSort="true" on all columns (or manually blanking with FT.sortOptions=[]).

More importantly (imo), it also allows optimization of the initial table rendering. When the initial sort is implicit (say the data comes from a SQL ORDER BY clause), avoiding the redundant sort can save several seconds in initial rendering time.

comment:2 Changed 13 years ago by Tom Trenka

Owner: changed from bill to Tom Trenka

comment:3 Changed 12 years ago by bill

Resolution: wontfix
Status: newclosed

Sorting in new Table widget will be done by so we aren't going to fix the sorting builtin to FilteringTable?.

Note: See TracTickets for help on using tickets.