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
sortkeysevery columns, each of columns should ownarrays of sortkeys(sure if required)there reasonble use max 6-8
sortkeysin visible rectangle returnsjviewport, otheriwse can see performance issue , ghosts insidejscrollpanerepaintingsortorder.unsortedisn't initial sort order,jtablesview can't store, remember that, don't know proper way, refreshjtablemodelyou can show sort icon programatically
Comments
Post a Comment