java - What is the easiest way to change the behaviour of JTable multi-column sorting? -
by default, if have more 1 sortkey in jtable's row-sorter, every click on column header make column's sortkey primary one.
i need change behaviour first click on column header makes sortkey primary one, click column header make column's sortkey secondary one, , on.
also, when, maxsortkeys reached, click on (not sorted) column trigger shuffling of sort-keys. newly clicked column have sortkey lowest priority, primary key column lose sortkey, , column secondary sortkey become primary one, etc.
at moment, implemented own tableheader in order capture event when user clicks on column header in order shuffle sortkeys appropriately.
to illustrate example:
[ 1 | 2 ↑1 | 3 ↓2 | 4 | 5 ↑3 ] [ | | | | ]
after user clicks on first column's header:
[ 1 ↑3 | 2 | 3 ↓1 | 4 | 5 ↑2 ] [ | | | | ]
what wonder whether think approach or not?
is required override
sortkeys
every columns, each of columns should ownarrays of sortkeys
(sure if required)there reasonble use max 6-8
sortkeys
in visible rectangle returnsjviewport
, otheriwse can see performance issue , ghosts insidejscrollpane
repaintingsortorder.unsorted
isn't initial sort order,jtables
view can't store, remember that, don't know proper way, refreshjtable
model
you can show sort icon programatically
Comments
Post a Comment