[SWINGX-271] TableSorting doesn't handle double clicks Created: 25/Feb/06  Updated: 28/Jan/11  Resolved: 05/Nov/10

Status: Resolved
Project: swingx
Component/s: Table
Affects Version/s: 1.6
Fix Version/s: 1.6.3

Type: New Feature Priority: Trivial
Reporter: jessewilson Assignee: kleopatra
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: All
Platform: Macintosh

Issuezilla Id: 271


When you want to quickly sort a table column in reverse order, it is intuitive to click on the header twice:
once for forward order and another time to reverse that order. But the second click is lost and the table is
sorted in forward order.

To demo this behaviour, open Mac Finder (or Windows Explorer) and double click on a column's header.
The column sorts once for each click.

On JXTable, the table ignores clicks after the first one.

Comment by kleopatra [ 02/Mar/06 ]

Hmm, the behaviour is copied from win2k explorer: a double click triggers only
one toggle of sort order

CC'd to usability - Ann could you please comment on this?


Comment by anns97 [ 02/Mar/06 ]

Jeanette, how fast can the sort and repaint happen?

When I played with Mac Finder, I noticed that in the amt of time I can do a
double click, it actually shows the sort first in one direction, and then in the
other direction, which produces the end result that the original issue filer
asked for.

I noticed Mozilla Thunderbird also has this behavior too.

That behavior makes sense to me - consistent and fast feedback.

But if there are any performance problems with the sort & repaint, then we might
look at a different soln (which may be to keep the current behavior)

Comment by jessewilson [ 02/Mar/06 ]

You're right about Windows 2000, I was comparing against the Mac Finder. Interestingly when you click 3
times on Windows 2000 you get sort then resort, but JXTable you only get a single sort. This is a weird
thing to test and I wouldn't say JXTable needs a different behaviour in this case.

I just found it annoying when I tried to sort a column in reverse, it refused to do it 'cause I kept clicking
too fast, and most of my clicks were dropped.

Comment by kleopatra [ 03/Mar/06 ]

Ann, performance shouldn't be a problem (normally), at least we can decide
without taking into account.

Hmm, just had a look at Thunderbird: it does take all clicks to trigger a sort
which feels funny for a already sorted column because in the end the sequence is
the same as before the first of the douple-clicks.

Mustang takes the first click only (my build is somewhere in the late sixties).

JXTable could go either way, or behave differently if the column is unsorted, or
make the behaviour configurable? ... Personally I prefer to react on a single
click only (and ignore the second of a double), but I'm open to be convinced.


Comment by kleopatra [ 10/Mar/06 ]
  • added JXTableHeader.SortGestureRecognizer and property
  • made JXTableHeader.HeaderListener let the recognizer decide
  • added visual test method (toggles between default and custom recognizer) to

Note: this is not formally tested, just a quick check if the double click can be
easily used for sorting! Would like to get feedback, the factoring might well be


Comment by kleopatra [ 04/Apr/06 ]

no complaints - so I'm closing

Comment by kleopatra [ 09/Jul/09 ]

re-open, as in the process of moving over to core sorting (jdk6+) the
SortGestureRecognizer is currently no longer used. Need to evalutate if/how we
can do ...

Comment by kleopatra [ 02/Nov/10 ]


  • JXTableHeader has a property resortsOnDoubleClick
  • its HeaderListener contains logic to toggle a second sort if that property is true and
    the column was unsorted before
  • added convenience api to JXTable to request the primary sort column index if existing
    and visible
Generated at Mon Feb 27 16:49:31 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.