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 own arrays of sortkeys (sure if required)

  • there reasonble use max 6-8 sortkeys in visible rectangle returns jviewport, otheriwse can see performance issue , ghosts inside jscrollpane repainting

  • sortorder.unsorted isn't initial sort order, jtables view can't store, remember that, don't know proper way, refresh jtable model

  • for example

  • you can show sort icon programatically


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -