Home > Net >  In Java why doesn't reapplying RowSorter to Swingx JXTable resore the sort?
In Java why doesn't reapplying RowSorter to Swingx JXTable resore the sort?

Time:02-10

I am using Java 11 and Swingx 1.6.6-SNAPSHOT (the latest version).

I have the following situation, two tables a View Table and an Edit table, the View table shows the data as as loaded, the Edit table lets you edit the table. Because both tables can be on screen at once you can visually compares edits with the original value.

We have an option to synchronize row sorting, so if you sort by some columns on the Edit table then the View table able automatically sorts to the same rows, this is my done by both tables sharing the same instance of TableSortController (EditSortController that uses the table model of the edit table)

enter image description here

Alternatively if this option is switched off then View Table has its own SortController (ViewSortController), and the tables can be sorted independently

This all works fine, the problem is when the user tries to switch between the two. If they change the option then the code calls the JXTable method setRowSorter() on View Table switching between two controllers, but it has no effect, I have added debugging to ensure setRowSorter is being called again.

Sort continues to work however it worked before switch is made, cant work out why

CodePudding user response:

  •  Tags:  
  • Related